Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How would i edit this script?

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.

2 comments

1

Please edit this post so it's in a lua code block.

0

Sorry, i am new to this site.

1 answer

✓ Accepted answer

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)

2 comments

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?

0

Add an if statement. I'll edit the post.

This discussion is preserved as it was. New answers, comments, and votes are closed.