HowToRoblox

GiveControls

Jun 20th, 2021
652
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local seat = script.Parent
  2.  
  3.  
  4. local bv = Instance.new("BodyVelocity", seat)
  5. bv.MaxForce = Vector3.new(0, 0, 0)
  6. bv.Velocity = Vector3.new(0, 0, 0)
  7.  
  8. local bg = Instance.new("BodyGyro", seat)
  9. bg.MaxTorque = Vector3.new(0, 0, 0)
  10.  
  11.  
  12. seat:GetPropertyChangedSignal("Occupant"):Connect(function()
  13.    
  14.        
  15.     for i, child in pairs(seat.Parent:GetChildren()) do
  16.  
  17.         if child.Name == "Particles" then
  18.  
  19.             child.ParticleEmitter.Enabled = seat.Occupant ~= nil
  20.         end
  21.     end
  22.    
  23.    
  24.     if seat.Occupant then
  25.        
  26.         seat:SetNetworkOwner(game.Players:GetPlayerFromCharacter(seat.Occupant.Parent))
  27.        
  28.         bv.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
  29.         bg.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
  30.        
  31.        
  32.     else   
  33.            
  34.         bv.MaxForce = Vector3.new(0, 0, 0)
  35.         bg.MaxTorque = Vector3.new(0, 0, 0)
  36.     end
  37. end)
RAW Paste Data