script.Parent.MouseButton1Click:connect(function(player)
if player:GetRankInGroup(6397199) >= 3 then
player.TeamColor = game.Teams["Emergency Response Team"].TeamColor
end
end)
I dont know why it dont work it is a normal Team Changer.
The “Error” is attempt to index nil with “GetRankInGroup” Thanks for your Help
MouseButton1Click doesn’t return the player instance of whom clicked it. (It doesn’t return any values, hence trying to take it in as a parameter returns nil)
Assuming this is in a local script (and given MouseButton1Click will be for a GUI it should be), the best way to get the player Instance is game:GetService(“Players”).LocalPlayer
you forgot define player in your variables, player doesn’t exist when TextButtons are trigged
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:connect(function()
if player:GetRankInGroup(6397199) >= 3 then
player.TeamColor = game.Teams["Emergency Response Team"].TeamColor
end
end)