Hello!
So I am trying to make it on join, my staff gets teamed to “Staff Team” however whenever they join, they don’t get teamed.
Heres my code:
local MPS = game:GetService(“MarketplaceService”)
game.ReplicatedStorage.Change.OnServerEvent:Connect(function(player)
if player:GetRankInGroup(6024516) >= 4 then
player.TeamColor = BrickColor.new(“Really red”)
player:LoadCharacter()
else
MPS:PromptGamePassPurchase(game.Players.LocalPlayer, 9361999)
end
end)
If this is a Server Script which I’m guessing it is, you can’t define LocalPlayer on Server Sided Scripts, could you also send the local script that fires the event?
And I’m not too sure you need a remote event to fire it, You could just use game.Players.PlayerAdded:Connect(function(player)
You don’t really need to use a RemoteEvent for doing that, instead by using PlayerAdded on a serverscript you can do the job!
Make sure the TeamColor is the correct one and Team Name also is!
local MPS = game:GetService("MarketplaceService")
game.Players.PlayerAdded:Connect(function(player)
if player:GetRankInGroup(6024516) >= 4 then
player.Team = game.Teams["Staff Team"]
player.TeamColor = BrickColor.new("Really red")
player:LoadCharacter()
else
MPS:PromptGamePassPurchase(player, 9361999)
end
end)
For this you will need to have the staff team inside the ‘Teams’ service! If you don’t have it in your explorer you can go in your Roblox Studio: Model → Service and add the Teams.