Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local player = game.Players.LocalPlayer
- local gui = Instance.new("ScreenGui")
- gui.Parent = player.PlayerGui
- local frame = Instance.new("Frame")
- frame.Size = UDim2.new(0, 240, 0, 96) -- Increased size by 1.6
- frame.Position = UDim2.new(0.5, -120, 0.5, -48)
- frame.Parent = gui
- -- Create UIGradient for the frame with dark blue to blue gradient
- local gradientFrame = Instance.new("UIGradient")
- gradientFrame.Rotation = 90
- gradientFrame.Color = ColorSequence.new(Color3.fromRGB(0, 0, 100), Color3.fromRGB(0, 0, 255)) -- Dark blue to blue gradient
- gradientFrame.Parent = frame
- local UICorner = Instance.new("UICorner")
- UICorner.CornerRadius = UDim.new(0, 10)
- UICorner.Parent = frame
- local button = Instance.new("TextButton")
- button.Size = UDim2.new(0, 200, 0, 48) -- Adjusted button size accordingly
- button.Position = UDim2.new(0.5, -100, 0.5, -24)
- button.Text = "Summon Part (1)"
- button.TextColor3 = Color3.new(1, 1, 1) -- White text color
- -- Create UIGradient for the TextButton
- local gradientButton = Instance.new("UIGradient")
- gradientButton.Rotation = 90
- gradientButton.Color = ColorSequence.new(Color3.fromRGB(0, 0, 255), Color3.fromRGB(0, 0, 255)) -- Blue to blue gradient
- gradientButton.Parent = button
- button.Parent = frame
- local blockCount = 1
- -- Function to update button text with block count
- local function updateButtonText()
- button.Text = "Summon Part (" .. blockCount .. ")"
- end
- -- Variables for GUI dragging
- local isDragging = false
- local dragStartOffset = UDim2.new(0, 0, 0, 0)
- frame.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- isDragging = true
- dragStartOffset = frame.Position - UDim2.new(0, input.Position.X, 0, input.Position.Y)
- end
- end)
- frame.InputEnded:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- isDragging = false
- end
- end)
- frame.InputChanged:Connect(function(input)
- if isDragging and input.UserInputType == Enum.UserInputType.MouseMovement then
- frame.Position = UDim2.new(0, input.Position.X, 0, input.Position.Y) + dragStartOffset
- end
- end)
- button.MouseButton1Click:Connect(function()
- local humanoidRootPosition = player.Character.HumanoidRootPart.Position
- local playerFacingDirection = player.Character.HumanoidRootPart.CFrame.LookVector
- for i = 1, blockCount do
- local part = Instance.new("Part")
- part.Size = Vector3.new(4, 4, 4)
- part.Position = humanoidRootPosition + playerFacingDirection *(5* i)
- part.BrickColor = BrickColor.new("Bright yellow")
- part.Anchored = false
- part.CanCollide = true
- part.Parent = game.Workspace
- end
- end)
- updateButtonText()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement