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

How would i edit this script?

Asked by 9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

Can you please help me? I have a script i want to make so when you click it, it shrinks and i know you put a click detector somewhere too. I don't want it to already be shrinking when i join the game. I already have this...

p=game.Workspace.Dirt

p.Size=Vector3.new(8,8,8) wait(1) p.Size=Vector3.new(7,7,7) wait(1) p.Size=Vector3.new(6,6,6) wait(1) p.Size=Vector3.new(5,5,5) wait(1) p.Size=Vector3.new(4,4,4) wait(1) p.Size=Vector3.new(3,3,3) wait(1) p.Size=Vector3.new(2,2,2) wait(1) p.Size=Vector3.new(1,1,1)

Dirt is the brick im trying to shrink. I just need to make it so when you click it, it runs this command.

1
Please edit this post so it's in a lua code block. F_lipe 135 — 9y
0
Sorry, i am new to this site. QuantumScripter 48 — 9y

1 answer

Log in to vote
1
Answered by 9 years ago

First of all, separate your code. Add a click detector with this script as its child.

script.Parent.ClickDetector.MouseClick:connect(function() -- when clicked, do this:
p=game.Workspace.Dirt
if p.Size = Vector3.new(9,9,9) -- this only works if the size of the dirt is 9x9x9
p.Size=Vector3.new(8,8,8) 
wait(1)
 p.Size=Vector3.new(7,7,7) 
wait(1) 
p.Size=Vector3.new(6,6,6) -- 666 :o
 wait(1) 
p.Size=Vector3.new(5,5,5) 
wait(1)
 p.Size=Vector3.new(4,4,4) 
wait(1) 
p.Size=Vector3.new(3,3,3) 
wait(1) 
p.Size=Vector3.new(2,2,2)
 wait(1)
p.Size=Vector3.new(1,1,1)
end
end)
0
If i wanted it so right after when i click it, it only runs this one time and you cant click it anymore. How would i do this? Because right now what its doing is when i click it, it shrinks, then when its smallest size, i can click it again and it starts over again. I don't want this to happen, can you please help me? QuantumScripter 48 — 9y
0
Add an if statement. I'll edit the post. theD1R3W0LF 20 — 9y
Ad

Answer this question