Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
601
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. MainBankScript
  2. -----------------------
  3. local debounce = false
  4. local playerfound = false
  5.  
  6. function CreateRegion3FromPart(Part)
  7. return Region3.new(Part.Position-(Part.Size/2),Part.Position+(Part.Size/2))
  8. end
  9.  
  10. function GetPlayersInPart(part)
  11. local region = CreateRegion3FromPart(part)
  12. local partsInRegion = workspace:FindPartsInRegion3(region,nil,math.huge)
  13. local Players = {}
  14.  
  15.  
  16. for i,Part in pairs(partsInRegion) do
  17. local player = game.Players:GetPlayerFromCharacter(Part.Parent)
  18. if player then
  19.  
  20. for i, v in pairs(Players) do
  21. if Players[i].Name == player.Name then
  22. playerfound = true
  23. end
  24. end
  25.  
  26. if playerfound == false then
  27. table.insert(Players,player)
  28. end
  29. playerfound = false
  30. end
  31. end
  32.  
  33. for i, v in pairs(Players) do
  34. if Players[i].CashCollected.Value < 1500 then
  35. Players[i].CashCollected.Value = Players[i].CashCollected.Value + 150
  36. end
  37. end
  38. return Players
  39. end
  40.  
  41. while wait(1) do
  42. GetPlayersInPart(game.Workspace.BankDetector)
  43. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement