How to make a gui pop up when a team is changed

I’m having trouble on a script. When the player switches to team “Host” You are supposed to get a GUI popped up but it’s currently not working.

The Team.Changed Function is not running.

I’m not sure, but maybe the team events aren’t being triggered because the player’s team is being changed on the client side, so it won’t notify the server when the player changes teams.

I would recommend using Team.PlayerAdded

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Teams = game:GetService("Teams")

local HostTeam = Teams.Host -- or wherever your Team object is

local RemoteEvent = ReplicatedStorage.ChangeTrainingVal

HostTeam.PlayerAdded:Connect(function(player)
    RemoteEvent:FireClient(player)
end)
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.