Advertisement
itchyzombie

asshat service

Aug 11th, 2015
331
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.60 KB | None | 0 0
  1. local players=game:GetService'Players'
  2. asshat={}
  3. --GetHumanoidFromAsshat
  4. --GetPlayerFromAsshat
  5. --GetBottomCharacter
  6.  
  7. --[[
  8.    
  9.     if the player isn't sitting then they own all the connect parts
  10. --]]
  11. function asshat.create()
  12.     local hat=Instance.new'Hat'
  13.     hat.Name='Asshat'
  14.     hat.AttachmentPos=Vector3.new(0, 0.4, 0)
  15.     local seat=Instance.new'Seat'
  16.     seat.Parent=hat
  17.     seat.Name='Handle'
  18.     seat.Size=Vector3.new(2, 1, 1)
  19.     seat.Transparency=1
  20.     local bf=Instance.new('BodyForce', seat)
  21.     bf.force=Vector3.new(0, seat:GetMass()*200, 0)
  22.     return hat
  23. end
  24.  
  25. function asshat.register(player, _)
  26. player = type(player)=='number' and _ or player
  27.     player.CharacterAdded:connect(function(char)
  28.         repeat wait() until char.Parent==workspace
  29.         wait(1)
  30.         local hat=asshat.create()
  31.        
  32.         hat.Parent=char
  33.         print(hat)
  34.         hat.Handle:SetNetworkOwner(player)
  35.         local humanoid=char:WaitForChild'Humanoid'
  36.         humanoid.Changed:connect(function(prop)
  37.             if prop=='Sit' and humanoid.Sit==false then
  38.                 for _, part in pairs(char:WaitForChild'Torso':GetConnectedParts(true)) do
  39.                     print(part:GetFullName(), player)
  40.                     part:SetNetworkOwner(player)
  41.                 end
  42.             end
  43.         end)
  44.         local seat=hat.Handle
  45.         seat.Changed:connect(function(prop)
  46.             if prop=='Occupant' then
  47.                 if seat.Occupant then
  48.                     for _, part in pairs(char:WaitForChild'Torso':GetConnectedParts(true)) do
  49.                         print(part:GetFullName(),char.Torso:GetNetworkOwner())
  50.                         part:SetNetworkOwner(char.Torso:GetNetworkOwner())
  51.                     end
  52.                 end
  53.             end
  54.         end)
  55.     end)
  56. end
  57.  
  58. table.foreachi(players:GetPlayers(), asshat.register)
  59. players.PlayerAdded:connect(asshat.register)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement