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

How would I use CFrame instead of Position?

Asked by 8 years ago

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

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

Log in to vote
0
Answered by
Ryzox 220 Moderation Voter
8 years ago

Using Positionwill put it above the object if is colliding with another block. Using CFrameis 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)


0
Alright, but one question, why use a * instead of +? ghostblocks 74 — 8y
Ad

Answer this question