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

Anyone know the issue to this script?

Asked by
DevWork 80
10 years ago

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)

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. fireboltofdeath 635 — 10y
0
I'l try, thanks. DevWork 80 — 10y
0
:PlayerHasPass will not work in LocalScripts. fahmisack123 385 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago
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
]]
Ad

Answer this question