Player has joined the game

Hello!
I wanted to kwo how to make it soo eveytime some one joins a little GUI shows in the screen(a text label)
but i dont really kwo how to make it.
Can anyone help me?
btw i made this but its trash

game.Players.PlayerAdded:Connect(function(player)
print(“working”)
print(player.Name…“has joined”)
if print(“working”) then game.StarterGui.ScreenGui.TextLabel.Visible = true
end
end)

2 Likes

a script. i want soo everyone can see it

Alright, so first make sure it’s in ServerScriptStorage. Once it’s moved there, have a look and see if the print works. Getting the GUI to show is a bit more tricky, but can be easily done and I’ll help you out with it.

game.StarterGui.ScreenGui.TextLabel.Visible = true

This line won’t work because the GUI is cloned and put into a user’s own playergui when they join a game.

Instead what you can do:
Make a bool value (true/false) that is manipulated by a normal script and inside your GUI have a local script that constantly checks if the value is true/false, if it’s true then the text label should be visible if it’s false the text label should be invisible.

game.StarterGui is not what the player sees. that would be player.PlayerGui.

If you want to tell everyone that someone joined, fire all clients for a remote event.

game.Players.PlayerAdded:Connect(function(player)
    print(“working”)
    print(player.Name…“has joined”)
    if print(“working”) then 
        game.ReplicatedStorage.PlayerJoined:FireAllClients(player.Name)
    end
end)
game.ReplicatedStorage.PlayerJoined.OnClientEvent:Connect(function(name)
    script.Parent.Visible = true --script.Parent would be what you want to become visible
end)
1 Like

soo i put the first on server script service and the other on the text label?
if yes i did that and it shows thisimage

You have to make a removeevent in ReplicatedStorage, called “PlayerJoined”, then in your localscript, detect when the event has fired, then make the gui visible.

And that’s why you can’t just copy whatever people write, because they are usually examples.

1 Like

None of it works anyway it just underlines even though I added the remote even in replicated storage

1 Like

I see some errors that could be why. change the " " to ’ ’

that script is wrong the “working” its on “” not on " and on the
print(player.name
you put 3 … they only need to be 2

alredy did that no error shows up but still dont work


image

Pretty sure you can just remove the if print("working") then because I don’t think the code is getting past that and it’s unnecessary.

Worked for me. Thanks @IAmPinleon :smiley:

1 Like

now the problem is making it soo in 4-5 secs its visible = false

just do

wait(4)
script.parent.visible = false

i did that lol im not dumb but didint worked

It worked for me so could you send a screenshot