Advertisement
HowToRoblox

HelicopterSetup

Apr 24th, 2021
3,493
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.79 KB | None | 0 0
  1. local bp = Instance.new("BodyPosition")
  2. bp.MaxForce = Vector3.new(0, 0, 0)
  3. bp.Parent = script.Parent.VehicleSeat
  4.  
  5. local bg = Instance.new("BodyGyro")
  6. bg.MaxTorque = Vector3.new(0, 0, 0)
  7. bg.Parent = script.Parent.VehicleSeat
  8.  
  9.  
  10.  
  11. script.Parent.VehicleSeat.Changed:Connect(function()
  12.    
  13.     local occupant = script.Parent.VehicleSeat.Occupant
  14.    
  15.     if occupant then
  16.        
  17.         local player = game.Players:GetPlayerFromCharacter(occupant.Parent)
  18.        
  19.         if player then
  20.             script.Parent.VehicleSeat:SetNetworkOwner(player)
  21.            
  22.             bp.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
  23.             bg.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
  24.         end
  25.        
  26.     else
  27.        
  28.         bp.MaxForce = Vector3.new(0, 0, 0)
  29.         bg.MaxTorque = Vector3.new(0, 0, 0)
  30.         script.Parent.VehicleSeat:SetNetworkOwner(nil)
  31.     end
  32. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement