Advertisement
albinio546

Force Field

Aug 15th, 2015
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. local fflength = 5
  2. local unlimited = false
  3.  
  4. function onNewChild(obj, char)
  5. if obj:IsA("Tool") then
  6. for i, v in pairs(char:GetChildren()) do
  7. if v:IsA("ForceField") then
  8. v:Remove()
  9. end
  10. end
  11. end
  12. end
  13.  
  14. function onSpawn(newCharacter)
  15. ff = Instance.new("ForceField",newCharacter)
  16. if unlimited == false then
  17. game.Debris:AddItem(ff, fflength)
  18. end
  19. newCharacter.ChildAdded:connect(function(child) onNewChild(child,newCharacter) end)
  20. end
  21.  
  22. function onPlayerAdded(newPlayer)
  23. newPlayer.CharacterAdded:connect(onSpawn)
  24. end
  25.  
  26. game.Players.PlayerAdded:connect(onPlayerAdded)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement