Hey! So I made this script to be able to control a rocket, bascially when the orientation gets to like 90,blah,blah it stops rotating in the X. How to fix?
local userinput= game:GetService("UserInputService")
local Direct = game.ReplicatedStorage.RocketEvents.Direction
holdinga = false
holdingd = false
holdingw = false
holdings = false
userinput.InputBegan:Connect(function(k)
if k.KeyCode == Enum.KeyCode.A then
holdinga=true
while holdinga == true do wait()
for i = 1,25 do
Direct:FireServer(0,0.00,-0.027)
--if workspace.RealRocket.PrimaryPart.Orientation.Z == -90 then
-- game.ReplicatedStorage.RocketEvents.ChangeOrientation:FireServer(-92)
--end
end
end
end
end)
userinput.InputEnded:Connect(function(k)
if k.KeyCode == Enum.KeyCode.A then
holdinga = false
end
end)
userinput.InputBegan:Connect(function(k)
if k.KeyCode == Enum.KeyCode.D then
holdingd=true
while holdingd == true do wait()
for i = 1,25 do
Direct:FireServer(0,0.00,0.027)
end
end
end
end)
userinput.InputEnded:Connect(function(k)
if k.KeyCode == Enum.KeyCode.D then
holdingd = false
end
end)
userinput.InputBegan:Connect(function(k)
if k.KeyCode == Enum.KeyCode.W then
holdingw=true
while holdingw == true do wait()
for i = 1,25 do
Direct:FireServer(-0.027,0.00,0)
--if workspace.RealRocket.PrimaryPart.Orientation.X == -90 then
-- game.ReplicatedStorage.RocketEvents.ChangeOrientation2:FireServer(-95)
--end
end
end
end
end)
userinput.InputEnded:Connect(function(k)
if k.KeyCode == Enum.KeyCode.W then
holdingw = false
end
end)
userinput.InputBegan:Connect(function(k)
if k.KeyCode == Enum.KeyCode.S then
holdings=true
while holdings == true do wait()
for i = 1,25 do
Direct:FireServer(0.027,0.00,0)
-- game.ReplicatedStorage.RocketEvents.ChangeOrientation:FireServer(182)
end
end
end
end)
userinput.InputEnded:Connect(function(k)
if k.KeyCode == Enum.KeyCode.S then
holdings = false
end
end)