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

Why doesn't this script work?

Asked by 10 years ago

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

I'm trying to fix the problem in the script's position:

script.Parent.MouseClick:connect(function(click)
script.Parent.Parent.Position = Vector3.new(-7, 8, -4)
script.Parent.Parent.CFrame = CFrame.Angles(0, -45, 0)
wait(2)
script.Parent.Parent.Positiob = Vector3.new(-7, 8, -4)
script.Parent.Parent.CFrame = CFrame.Angles(0, -89.98, 0)
wait(2)
script.Parent.Parent.Position = Vector3.new(-7, 8, -4)
script.Parent.Parent.CFrame = CFrame.Angles(0, 0, 0)
end)

I even set the position to where its supposed to be, but its still changing the position to: 0, 0, 0

1 answer

Log in to vote
0
Answered by 10 years ago

You misspelt "Position" on like 5.

In addition, setting CFrame like that doesn't work. Use

script.Parent.Parent.CFrame=script.Parent.Parent.CFrame*CFrame.Angles(insert,angles,here)

A better way to do this, in fact, would be to use this:

script.Parent.MouseClick:connect(function(click)
script.Parent.Parent.CFrame = CFrame.new(-7, 8, -4)*CFrame.Angles(0, -45, 0)
wait(2)
script.Parent.Parent.CFrame = CFrame.new(-7, 8, -4)*CFrame.Angles(0, -89.98, 0)
wait(2)
script.Parent.Parent.CFrame = CFrame.new(-7, 8, -4)*CFrame.Angles(0, 0, 0)
end)

There are some slight differences between using Position and CFrame though. CFrame pulls the entire model (all welded parts) with it, while Position doesn't, and Position also puts the block on top of any part that is occupying the same space.

0
Thats the exact opposite of the answer I got in the roblox website.. xD Operation_Meme 890 — 10y
0
The problem is CFrames have two components, position and rotation. Setting it to 'CFrame.Angles' creates a new CFrame with a position of (0,0,0). RenderSettings 35 — 10y
Ad

Answer this question