So im trying to make a box open by it being slow at first but speeding up each time it reaches the limit and then exploding. However the Orientation movements are WAY to drastic.
Here is my code!
local times = 1 local factor = 1 local rotation = 0 while wait(0.3) do if times == 6 then break end for i,x in pairs(script.Parent:GetChildren()) do if x:IsA("BasePart") then print(x.Orientation.X-factor) x.CFrame = x.CFrame * CFrame.Angles(x.Orientation.X-factor,0,0) end end rotation = rotation - factor end script.Parent.Union.Changed:connect(function() if rotation == -40 then times = times + 1 factor = -times elseif rotation == 40 then times = times + 1 factor = times end end)
I have no idea what I am doing wrong.
Because you're inputting degrees when CFrame.Angles takes radians. You need to convert it to radians by using math.rad.
x.CFrame = x.CFrame * CFrame.Angles(math.rad(x.Orientation.X-factor), 0, 0)