That is the script when I use it it gives no errors in the console but also does not work. It is a normal script as the teaming appears not to work in local scripts. I hope I can get an answer soon.

Note: the script is meant for a TextButton.

local mps = game:GetService("MarketplaceService")
local gamepass = 5830313



function Click()
    game.Players.PlayerAdded:Connect(function(player)
 while true do
  if mps:UserOwnsGamePassAsync(player.UserId,gamepass) then
    plr.TeamColor = BrickColor.new("Plum")
else
    print("Player does not own pass.")
  end
  wait(5)
 end
end)
end



script.Parent.MouseButton1Click:connect(Click)

4 comments

0

Please specify do you want them to instantly be teamed as they join or as they click the button? Also you cant connect to functions in one function....

0

You can absolutely connect a function within a function. I just tested it and it works.

0

Why are you putting a ServerScript inside of a GUI?

0

To clarify a few things: 1. This script is for a text button and 2. It is a ServerScript because the teaming part appears not to work in a localScript