How do I make a click part?

How would I make a part when clicked it moves 1 stud each time it’s clicked?

Example of about what I have, besides the click function

Script.parent.parent.PartName.Position = vector3.new( 1,0)

ClickDetectors.

They’re very useful.

1 Like

Vouch above. That script is going to error I believe. A Vector3 requires an X, Y, and Z value.

You’re probably just better off doing the following:

-- Create a click detector as a child of your part. Inside of it.
local ClickDetector = game.Workspace.PartName:WaitForChild("ClickDetector")

-- In the documentation, MouseClick is for ANY click on the part. The ClickDetector detects the mouseclick.
ClickDetector.MouseClick:Connect(function()
   game.Workspace.PartName.Position += Vector3.new(1, 0, 0) -- Moves one to the right on the X axis. (X, Y, Z)
end)

Hope this post helps!

1 Like

OHHHH the += I was using + and kept getting the error like can’t (add). I already knew about the clickDetector and such I also wasnt copy and pasting my code sorry lol. This really has helped so much! I’ll give it a try soon.

Thanks, I knew about the clickDetectors already. <3

you can also get a click part too! by adding it into your work space and from there you can code that part

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.