Dfgjfj

PlayerHandler

Feb 18th, 2025
337
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1.  
  2. local Players = game:GetService("Players")
  3. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  4. local PlayerValue = ReplicatedStorage:WaitForChild("Player")
  5. Players.PlayerAdded:Connect(function(plr)
  6. if PlayerValue.Value == nil then
  7. PlayerValue.Value = plr
  8. print("New User whitelisted")
  9. else
  10. plr:Kick("Only one player is allowed")
  11. end
  12. end)
  13.  
  14. Players.PlayerRemoving:Connect(function(plr)
  15. if PlayerValue.Value == plr then
  16. PlayerValue.Value = nil
  17. end
  18. end)
  19.  
Advertisement
Add Comment
Please, Sign In to add comment