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

Moving Platform Bug?

Asked by 8 years ago

So I basically an using a method of clicking a part to move it forward by 5 studs. So I make the script, but it says there is something wrong. I can't figure it out. Here is the script

Part  =  script.Parent

function move()
    Part.CFrame  =  Garrett.CFrame  *  Vector3.new(0,0,5)
end

Part.ClickDetector.MouseClick:connect(move)

The Script and Click detector is set inside the part.

2 answers

Log in to vote
2
Answered by
rexbit 707 Moderation Voter
8 years ago

Vector3 cannot multiply with CFrame.

Part  =  script.Parent

function move()
    Part.CFrame  =  Garrett.CFrame  *  CFrame.new(0,0,5)
end

Part.ClickDetector.MouseClick:connect(move)

Ad
Log in to vote
0
Answered by 8 years ago

So basically I have found the answer to the script. I cannot multiply Vector3 with CFrame, but I can add it.

Part = script.Parent
function move()
    Part.CFrame = Part.CFrame + Vector3.new(0,0,5)
end

Part.ClickDetector.MouseClick:connect(move)

Answer this question