Advertisement
lllkkklkk

block summoner

Jul 27th, 2024
12
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.73 KB | None | 0 0
  1. local player = game.Players.LocalPlayer
  2. local gui = Instance.new("ScreenGui")
  3. gui.Parent = player.PlayerGui
  4.  
  5. local frame = Instance.new("Frame")
  6. frame.Size = UDim2.new(0, 240, 0, 96) -- Increased size by 1.6
  7. frame.Position = UDim2.new(0.5, -120, 0.5, -48)
  8. frame.Parent = gui
  9.  
  10. -- Create UIGradient for the frame with dark blue to blue gradient
  11. local gradientFrame = Instance.new("UIGradient")
  12. gradientFrame.Rotation = 90
  13. gradientFrame.Color = ColorSequence.new(Color3.fromRGB(0, 0, 100), Color3.fromRGB(0, 0, 255)) -- Dark blue to blue gradient
  14. gradientFrame.Parent = frame
  15.  
  16. local UICorner = Instance.new("UICorner")
  17. UICorner.CornerRadius = UDim.new(0, 10)
  18. UICorner.Parent = frame
  19.  
  20. local button = Instance.new("TextButton")
  21. button.Size = UDim2.new(0, 200, 0, 48) -- Adjusted button size accordingly
  22. button.Position = UDim2.new(0.5, -100, 0.5, -24)
  23. button.Text = "Summon Part (1)"
  24. button.TextColor3 = Color3.new(1, 1, 1) -- White text color
  25.  
  26. -- Create UIGradient for the TextButton
  27. local gradientButton = Instance.new("UIGradient")
  28. gradientButton.Rotation = 90
  29. gradientButton.Color = ColorSequence.new(Color3.fromRGB(0, 0, 255), Color3.fromRGB(0, 0, 255)) -- Blue to blue gradient
  30. gradientButton.Parent = button
  31.  
  32. button.Parent = frame
  33.  
  34. local blockCount = 1
  35.  
  36. -- Function to update button text with block count
  37. local function updateButtonText()
  38. button.Text = "Summon Part (" .. blockCount .. ")"
  39. end
  40.  
  41. -- Variables for GUI dragging
  42. local isDragging = false
  43. local dragStartOffset = UDim2.new(0, 0, 0, 0)
  44.  
  45. frame.InputBegan:Connect(function(input)
  46. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  47. isDragging = true
  48. dragStartOffset = frame.Position - UDim2.new(0, input.Position.X, 0, input.Position.Y)
  49. end
  50. end)
  51.  
  52. frame.InputEnded:Connect(function(input)
  53. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  54. isDragging = false
  55. end
  56. end)
  57.  
  58. frame.InputChanged:Connect(function(input)
  59. if isDragging and input.UserInputType == Enum.UserInputType.MouseMovement then
  60. frame.Position = UDim2.new(0, input.Position.X, 0, input.Position.Y) + dragStartOffset
  61. end
  62. end)
  63.  
  64. button.MouseButton1Click:Connect(function()
  65. local humanoidRootPosition = player.Character.HumanoidRootPart.Position
  66. local playerFacingDirection = player.Character.HumanoidRootPart.CFrame.LookVector
  67.  
  68. for i = 1, blockCount do
  69. local part = Instance.new("Part")
  70. part.Size = Vector3.new(4, 4, 4)
  71. part.Position = humanoidRootPosition + playerFacingDirection *(5* i)
  72. part.BrickColor = BrickColor.new("Bright yellow")
  73. part.Anchored = false
  74. part.CanCollide = true
  75. part.Parent = game.Workspace
  76. end
  77. end)
  78.  
  79. updateButtonText()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement