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

Why doesn't this script work?

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

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.

2 comments

0

Thats the exact opposite of the answer I got in the roblox website.. xD

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).

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