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

How would I use CFrame instead of Position?

In this script I'm wanting this brick to move up when touched and while it does work, it teleports above my player instead of normally just going up. Basically, how would I get this to work with CFrame? The wiki didn't really help much, any help?

p = script.Parent
script.Parent.Touched:connect(function()
	for i=0,100,0.1 do
	wait(.01)
p.Position = p.Position + Vector3.new(0,1,0)
end
end)

1 answer

✓ Accepted answer

Using Position will put it above the object if is colliding with another block. Using CFrame is basically the same here is what your script would look like with CFrame:

p = script.Parent
script.Parent.Touched:connect(function()
	for i=0,100,0.1 do
    		wait(.01)
		p.CFrame= p.CFrame * CFrame.new(0,1,0)
	end
end)


1 comment

0

Alright, but one question, why use a * instead of +?

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