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)
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.
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)
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.