Advertisement
Guest User

Untitled

a guest
Jul 16th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. local replicated = game:GetService('ReplicatedStorage')
  2. local market = game:GetService('MarketplaceService')
  3.  
  4. local teamRemote = replicated.teamJoin
  5. local teamRequirement = script.TeamRequirement
  6.  
  7. local teams = game:GetService('Teams')
  8.  
  9. function giveTeam(player, teamName)
  10. if player then
  11. player.Team = teams[teamName]
  12. end
  13. end
  14.  
  15. teamRemote.OnServerEvent:Connect(function(player, teamName)
  16. for i,v in pairs(teamRequirement:GetChildren()) do
  17. if v.Name == teamName then
  18. print(teamName)
  19. for i,z in pairs(v:GetChildren()) do
  20. if z:FindFirstChild('GamepassID') then
  21. if market.UserOwnsGamePassAsync(player.UserId, z.Value) then
  22. giveTeam(player, teamName)
  23. else
  24. market:PromptGamePassPurchase(player, z.Value)
  25. end
  26. end
  27.  
  28. if z:FindFirstChild('GroupID') then
  29. local groupID = z.Value
  30. print(groupID)
  31.  
  32. if player:IsInGroup(z.Value) then
  33. if z:FindFirstChild('RankID') then
  34. local rankID = z.Value
  35. print(rankID)
  36.  
  37. if player:GetRankInGroup(groupID) >= rankID then
  38. if z:FindFirstChild('cantJoinID') then
  39. local cantID = z.Value
  40. print(cantID)
  41. if player:GetRankInGroup(groupID) >= cantID then
  42. else
  43. giveTeam(player, teamName)
  44. end
  45. end
  46.  
  47. end
  48. else
  49. giveTeam(player, teamName)
  50. end
  51. end
  52. end
  53.  
  54. end
  55. end
  56. end
  57. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement