yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
|
| 07 Mar 2015 08:40 AM |
How can io add q and e too barrel roll???
local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() local Speed = 0
local Ship = script.Parent.Ship
local KeyUnits = { r = 0, f = 0, a = 0, d = 0, w = 0, s = 0 }
-- Customizable Vars local MaxSpeed = 50 local SpeedStep = 5 -- by how much does speed change when you press key? local Rotation = math.pi/32
script.Parent.Ship.BodyForce.force = Vector3.new(0, 196.2, 0) * script.Parent.Ship:GetMass()
Mouse.KeyDown:connect(function(Key) if KeyUnits[Key] and Key ~= "r" and Key ~= "f" then KeyUnits[Key] = 1 elseif Key == "r" or Key == "f" then Speed = math.max(-MaxSpeed, math.min(Speed + (Key == "r" and 1 or -1) * SpeedStep, MaxSpeed)) end end)
Mouse.KeyUp:connect(function(Key) if KeyUnits[Key] then KeyUnits[Key] = 0 end end)
while wait(0.25) do script.Parent.Ship.BodyVelocity.velocity = (script.Parent.Ship.CFrame * CFrame.Angles(0, math.pi/2, 0)).lookVector * Speed script.Parent.Ship.BodyGyro.cframe = script.Parent.Ship.BodyGyro.cframe * CFrame.Angles(0 , (KeyUnits.a - KeyUnits.d) * Rotation, (KeyUnits.w - KeyUnits.s) * Rotation) end |
|
|
| Report Abuse |
|
|
yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
| |
|
murcury57
|
  |
| Joined: 30 Jun 2010 |
| Total Posts: 90299 |
|
| |
|
yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
|
| 07 Mar 2015 09:09 AM |
i added that but nothing
local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() local Speed = 0
local Ship = script.Parent.Ship
local KeyUnits = { r = 0, f = 0, a = 0, d = 0, w = 0, s = 0 }
-- Customizable Vars local MaxSpeed = 50 local SpeedStep = 5 -- by how much does speed change when you press key? local Rotation = math.pi/32
script.Parent.Ship.BodyForce.force = Vector3.new(0, 196.2, 0) * script.Parent.Ship:GetMass()
Mouse.KeyDown:connect(function(Key) if KeyUnits[Key] and Key ~= "r" and Key ~= "f" then KeyUnits[Key] = 1 elseif Key == "r" or Key == "f" then Speed = math.max(-MaxSpeed, math.min(Speed + (Key == "r" and 1 or -1) * SpeedStep, MaxSpeed)) end end)
Mouse.KeyUp:connect(function(Key) if KeyUnits[Key] then KeyUnits[Key] = 0 end end)
while wait(0.25) do script.Parent.Ship.BodyVelocity.velocity = (script.Parent.Ship.CFrame * CFrame.Angles(0, math.pi/2, 0)).lookVector * Speed script.Parent.Ship.BodyGyro.cframe = script.Parent.Ship.BodyGyro.cframe * CFrame.Angles(0 , (KeyUnits.a - KeyUnits.d) * Rotation, (KeyUnits.w - KeyUnits.s) * Rotation) end local Axis = { w = 0, a = 0, s = 0, d = 0, q = 0, e = 0 } local KeyDown
local Part = Instance.new("Part",workspace) Part.Anchored = true
Mouse.KeyDown:connect(function(Key) KeyDown = Key:lower() if(Key == "q")then Axis.q = 1 elseif(Key == "e")then Axis.e = 1 end end)
Mouse.KeyUp:connect(function(Key) Key = Key:lower() if(Key == "q")then Axis.q = 0 elseif(Key == "e")then Axis.e = 0 end end)
while wait() do Part.CFrame = Part.CFrame * CFrame.Angles(math.pi*2*math.rad(Axis.e-Axis.q),0,0) end |
|
|
| Report Abuse |
|
|
murcury57
|
  |
| Joined: 30 Jun 2010 |
| Total Posts: 90299 |
|
| |
|
yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
|
| 07 Mar 2015 09:13 AM |
HMm idk why but nothing
local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() local Speed = 0
local Ship = script.Parent.Ship
local KeyUnits = { r = 0, f = 0, a = 0, d = 0, w = 0, s = 0 }
-- Customizable Vars local MaxSpeed = 50 local SpeedStep = 5 -- by how much does speed change when you press key? local Rotation = math.pi/32
script.Parent.Ship.BodyForce.force = Vector3.new(0, 196.2, 0) * script.Parent.Ship:GetMass()
Mouse.KeyDown:connect(function(Key) if KeyUnits[Key] and Key ~= "r" and Key ~= "f" then KeyUnits[Key] = 1 elseif Key == "r" or Key == "f" then Speed = math.max(-MaxSpeed, math.min(Speed + (Key == "r" and 1 or -1) * SpeedStep, MaxSpeed)) end end)
Mouse.KeyUp:connect(function(Key) if KeyUnits[Key] then KeyUnits[Key] = 0 end end)
while wait(0.25) do script.Parent.Ship.BodyVelocity.velocity = (script.Parent.Ship.CFrame * CFrame.Angles(0, math.pi/2, 0)).lookVector * Speed script.Parent.Ship.BodyGyro.cframe = script.Parent.Ship.BodyGyro.cframe * CFrame.Angles(0 , (KeyUnits.a - KeyUnits.d) * Rotation, (KeyUnits.w - KeyUnits.s) * Rotation) end
local Axis = { q = 0, e = 0 }
Mouse.KeyDown:connect(function(Key) Key = Key:lower() if(Key == "q")then Axis.q = 1 elseif(Key == "e")then Axis.e = 1 end end)
Mouse.KeyUp:connect(function(Key) Key = Key:lower() if(Key == "q")then Axis.q = 0 elseif(Key == "e")then Axis.e = 0 end end)
while wait() do script.Parent.Ship.CFrame = script.Parent.Ship.CFrame * CFrame.Angles(math.pi*2*math.rad(Axis.e-Axis.q),0,0) end |
|
|
| Report Abuse |
|
|
murcury57
|
  |
| Joined: 30 Jun 2010 |
| Total Posts: 90299 |
|
| |
|
yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
| |
|