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

why is my Cframed brick going so fast, can you guys tell me?

Asked by 5 years ago

so today i discovered Cframes i have been messing with them

brick = script.Parent
    while true do 
    wait(0.001)
    brick.CFrame = brick.CFrame * CFrame.fromEulerAnglesXYZ(0.01,02,0)

    end


pls help

1 answer

Log in to vote
0
Answered by
royaltoe 5144 Moderation Voter Community Moderator
5 years ago
Edited 5 years ago

You're moving your brick 2 radians (about 114 degrees) in the y-axis every fraction of a second, which is a really big leap. You could do the following:

brick = script.Parent
while wait() do 
    brick.CFrame = brick.CFrame * CFrame.fromEulerAnglesXYZ(0 ,math.rad(1),0)
end

But I prefer to do the following:

brick = script.Parent

--runs the loop every 0.03 seconds (the default wait time)
while wait() do 
    --rotate the brick 1 degree in the x axis
    brick.CFrame = brick.CFrame * CFrame.Angles(math.rad(1), 0, 0)
end

math.rad() converts a degree to a radian which is what the functions take as parameters

0
ok thanks im pretty new to Cframe scripting Vortex_Vasne 89 — 5y
0
Np glad you're going at it royaltoe 5144 — 5y
Ad

Answer this question