Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

I need help with my block placer script that's not working right?

Asked by 6 years ago

I dont know why but this script keeps putting down a tower instead of one part. Its suppose to loop and make it so I put one part down at a time but instead it puts down a ton of them stacked on each other and then stops.

Code...

01wait(2)
02local player = game.Players.LocalPlayer
03local mouse = player:GetMouse()
04local blankPart = game.Players.LocalPlayer.PlayerGui.BlockGui.Block.Part
05blankPart.Anchored=true
06blankPart.CanCollide=false
07blankPart.Transparency=0.75
08 
09local mouseDown = false
10local connection
11 
12connection = mouse.Move:Connect(function()
13    if not mouseDown then
14     --wait(0.1)
15        local part = blankPart:Clone() --never change the original part, only a clone
View all 33 lines...
0
You’re creating a new part every time the mouse moves. User#19524 175 — 6y
1
Oh how do I fix it? protectiverobos -50 — 6y
0
Make an if statement to check if a part is in workspace. User#19524 175 — 6y
1
So if game.workspace.Part then (code)? protectiverobos -50 — 6y
View all comments (4 more)
1
and If game.workspace.Part = nil then (create part)? protectiverobos -50 — 6y
1
But I want if to create a lot of parts, not just one. So I can keep putting more down. protectiverobos -50 — 6y
0
How do I make it so that I can see the part moving when I move the mouse but then I place it , and then I can do it again instead of once? protectiverobos -50 — 6y
0
Try redefining connection on line 12 as mouse button 1click or something instead of move idk why move OBenjOne 190 — 6y

Answer this question