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

How do I change the position of a part?

Asked by
Zeluxis 100
7 years ago

I'm unsure on how to fix this code and why it wont work. Can someone hint me in the right direction?

function Click()
    script.Parent.Position=Vector3.FromAxis(17.142,26.116,-263.459)
end

game.Workspace.restraint1.ClickDetector.mouseClick:connect(Click)

1 answer

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

Simple change:

local clicker = script.Parent
local part = script.Parent.Parent

clicker.mouseClick:connect(function()
    part.Position = Vector3.new(0,0,0) --change to position you want
end)

make sure this is a script inside click detector and make sure the click detector is in a part.

so the order will be part's children is click detector, click detector children is script

Please accept answer and upvote if helped!

Ad

Answer this question