Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I check if a player owns a pass and then team them?

Asked by 4 years ago
Edited 4 years ago

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)
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.... voidofdeathfire 148 — 4y
0
You can absolutely connect a function within a function. I just tested it and it works. Unhumanly 152 — 4y
0
Why are you putting a ServerScript inside of a GUI? Unhumanly 152 — 4y
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 eek7000 0 — 4y

Answer this question