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

Trying to make a vehicle pit maneuver script, but orientation freezes the location?

Asked by 4 years ago
So, I was trying to make a script that would "pit" the vehicle but when I told it to rotate the wheels the orientation would freeze there world position, I tried setting is to the wheels positon before the orientation but obviously that didn't work, any ideas?
debounce = true
script.Parent.Touched:Connect(function(Hit)
    if Hit.Name == "PitPart" then
        debounce = false
        local FL = Hit.Parent.Parent.Wheels.FL
        local FR = Hit.Parent.Parent.Wheels.FR
        for i = 1,25 do
            wait()
            FL.CFrame = CFrame.new(FL.Position) * CFrame.Angles(90, math.rad(180), 0)
            FR.CFrame = CFrame.new(FR.Position) * CFrame.Angles(90, -math.rad(180), 0)
        end
        debounce = true
    end
end)

Answer this question