BumpyPlayz

Script 4 - Team Changing GUI

Apr 15th, 2020
5,177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.04 KB | None | 0 0
  1. local mps = game:GetService("MarketplaceService")
  2.  
  3. for i,v in pairs(game.Teams:GetChildren()) do
  4.    
  5.     if v:IsA("Team") then
  6.         local clone = v:Clone()
  7.         clone.Parent = script
  8.     end
  9.    
  10. end
  11.  
  12. game.Players.PlayerAdded:Connect(function(player)
  13.     player.Team = nil
  14. end)
  15.  
  16. game.ReplicatedStorage.TeamChange.OnServerEvent:Connect(function(player, teamname)
  17.     if script:FindFirstChild(teamname) then
  18.         if game.Teams:FindFirstChild(teamname) then
  19.             if player.Team == game.Teams:FindFirstChild(teamname) then
  20.             else
  21.                 local teamchosed = script:FindFirstChild(teamname)
  22.                 if teamchosed:FindFirstChild("GamepassID") then
  23.                     if mps:UserOwnsGamePassAsync(player.UserId, teamchosed.GamepassID.Value) then
  24.                         player.Team = game.Teams:FindFirstChild(teamname)
  25.                     else
  26.                         mps:PromptGamePassPurchase(player, teamchosed.GamepassID.Value)
  27.                     end
  28.                 elseif teamchosed:FindFirstChild("DevProductID") then
  29.                     mps:PromptProductPurchase(player, teamchosed.DevProductID.Value)
  30.                 else
  31.                     player.Team = game.Teams:FindFirstChild(teamname)                  
  32.                 end
  33.             end
  34.         end
  35.     end
  36. end)
Advertisement
Add Comment
Please, Sign In to add comment