Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Anyone know the issue to this script?

It wont team the person to team SWAT if they have the gamepass. I'm needing it to reset the player when they change team if they have the gamepass.

player = script.Parent.Parent.Parent.Parent.Parent
id = 164948636

script.Parent.MouseButton1Click:connect(function()
 if Game:GetService("GamePassService"):PlayerHasPass(player, id) then
  player.TeamColor = game.Teams['SWAT'].TeamColor
  player.Character:breakJoints()
 end
end)

3 comments

0

Have you tried putting this in local script and change player = script.Parent.Parent.Parent.Parent.Parent to player = game.Players.LocalPlayer Stuff like this you should make a model and put a link to it. Best we know player(Variable) Could mean a nil value the best we know.

0

I'l try, thanks.

0

:PlayerHasPass will not work in LocalScripts.

1 answer

id = 164948636

script.Parent.MouseButton1Click:connect(function(player)
 if game:GetService("GamePassService"):PlayerHasPass(player, id) then --game:Get got Game:Get
  player.TeamColor = game.Teams.SWAT.TeamColor
  player.Character:breakJoints() --This line could be an error. I'm not sure how to fix this.
 end
end)

--[[ If Line 5 is the error, maybe it should be
player.TeamColor = Color.new(game.Teams.SWAT.TeamColor)
instead of what is there
]]

This discussion is preserved as it was. New answers, comments, and votes are closed.