Script:

Playeradded is not firing, is it because I’m in studio? Thanks
Script:

Playeradded is not firing, is it because I’m in studio? Thanks
Is it a local script or a server script?
Localscript, that’s why I used Fireserver().
Ahh yes i didnt saw this.
Okay so the function will only fire if another player joins - It wont fire for you.
I also dont understand why you want to fire a remote event when the player joins?
just use
game.Players.PlayerAdded:Connect(function(Player) inside of a server script?
But it will work when I publish my game and join it normally (via roblox)?
If you are using this method on a local script it will only detect if other players join - It wont detect if you join
Use Players.ChildAdded:Connect(function() end). Same thing but it works on both, server and client.
Yeah but I need the player variable.
the player variable is here:
game.Players.PlayerAdded:Connect(function(Player) print(Player.Name) end
Then do this: Players.ChildAdded:Connect(function(player) end)
Where is the script located? Have you tried printing anything at all?
For a LocalScript, you can just access the player with the LocalPlayer property. It’s implicitly available to all LocalScripts no matter the execution time (ReplicatedFirst or standard execution).
local Player = game:GetService("Players").LocalPlayer
PlayerAdded doesn’t fire for yourself in a LocalScript because PlayerAdded has already fired before LocalScripts even start running. The connection made by the LocalScript will be created a fair amount of time after PlayerAdded has already fired.
Also please don’t use ChildAdded as someone else is suggesting. If PlayerAdded doesn’t work neither would ChildAdded, but even more importantly, it’s not the proper way to check for a new player. Use the canonical events.
I’m doing it in a serverscript now.
I know, playeradded works better imo
Honestly, i dont see why you’d want to use PlayerAdded within a localscript. PlayerAdded should only fire once when the client loads in, therefore you could just fire the remote event within a localscript withing StarterPlayerScripts.
If you need the player then you can get the player by doing Players.LocalPlayer
I’m using a serverscript now. I figured it’s smarter to just use playeradded in the serverscript.
But it does not work. I don’t know why
show the script
im right noew bro
Send your server script
ignore this
game.Players.PlayerAdded:Connect(function(player)
print(player.. " has joined")
local char = player.Character
local ev = game.ReplicatedStorage.Events
local bg = Instance.new("BillboardGui", char.Head)
local il = Instance.new("ImageLabel", bg)
bg.Adornee = char.Head
bg.ExtentsOffset = Vector3.new(1.5, 5, 0)
bg.MaxDistance = 30
bg.Size = Vector2.new({3,0}, {3,0})
wait(7)
ev.One.OnServerEvent:Connect(function()
print("1")
end)
ev.Two.OnServerEvent:Connect(function()
print("2")
end)
ev.Three.OnServerEvent:Connect(function()
print("3")
end)
ev.Four.OnServerEvent:Connect(function()
print("4")
end)
ev.Five.OnServerEvent:Connect(function()
print("5")
end)
end)
Don’t mind the extra stuff
Does the output says that the player has joined?