The GUI wont work with my function but only with player added?

this does not work

local function Zombify(player)
    if player.Team == game.Teams.Zombies then
  XPMsgFrame.Visible = true
end
end

but this works

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
    	
    	if player.Team == game.Teams.Zombies then
    		XPMsgFrame.Visible = true
    	end	
    end)
    end)
2 Likes

Are you calling the function at all?

You’re most likely not.

What is XPMsgFrame though?

Yes i am calling the function, its a GUI frame.

when your calling the function do you set player as game.Player.LocalPlayer, in the local script.

Can you show us the full code? We need to see where you call the function.

If you are using the first Code, then you have to do after your Code if its in a Localscript:

Zombify(game.Players.LocalPlayer)

if its in a Script:

game.Players.PlayerAdded:Connect(function(Player) Zombify(player) end)