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

How To Do Propeller Animations?

Asked by 8 years ago

I'm Building A Game Called WW1 Glory. I'm Having Trouble Making A Propeller Spinning Script And I Don't Want A Example From The Toolbox.

2 answers

Log in to vote
0
Answered by 8 years ago

Using CFrames and welding would be the best way. This is untested, but should work

local prop = script.Parent.Propeller
local propw = Instance.new("Weld", script.Parent)
propw.Part0 = script.Parent.PropellerBase
propw.Part1 = prop
local rotv = 0
local on = true
while on == true do
    wait()
if rotv ~= 360 then
rotv = rotv +1
elseif rotv == 360 then
rotv = 0
end
propw.C1 = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(rotv),0)

end

Ad
Log in to vote
0
Answered by
sigve10 94
8 years ago

Quick answer to this: CFrame.Angles

Let's say you have a part in workspace called Propel101 This is basically what you would do: (put this in a lonely script, without any other loops)

while wait() do
    workspace.Propel101.CFrame = workspace.Propel101.CFrame * CFrame.Angles(math.pi/100, 0, 0)
end

if the propel doesn't spin as it should, try moving the math.pi part into another axis. If it moves the opposite way of which you want it to, simply add a - to the pi, like this: -math.pi/100. If it moves too slowly, change the number after math.pi (the one that is being divided by), into something like math.pi/10

Hope this helped. Any questions/problems? Ask in the comments below

Answer this question