✓ Accepted answer
I am not sure why you would use a remote event for this, seeing that the PlayerAdded event never fires for the local player on the client and that using a remote for this purpose would be useless and insecure.
Better way to add leaderstats
If you are simply adding leaderstats for a player, the best bet would be to just do it in a server script, it is more secure and more efficient.
you can simply do the following on a server script for leaderstats
game.Players.PlayerAdded:Connect(function(plr)
local ls = Instance.new("Folder")
ls.Name = "leaderstats"
local stat = Instance.new("StringValue")
stat.Name = "stat"
stat.Value = "A stat"
stat.Parent = ls
...
ls.Parent = plr
end)
However, if you are playing to do something else you didn't specify, you can essentially simulate a player added event by running code directly at the top of the local script, as local scripts are cloned into the player / character when they join.
Ex:
-localscript
local event = game.ReplicatedStorage.Event
local plr = game.Players.LocalPlayer
event:FireServer(plr.Name)
4 comments
I’m very sure everyone has an idea what your issue is
in the title: not work? :D
ahem , playeradded, ahem in local script
can ya fix it (still gave both playeradded and fireserver) ?