What do you want to achieve?
Just create a new attribute when the player joins
What is the issue?
it just doesnt work at all idk why but if i put it out of the function it just works??? It works but i think it might be harder code like this later on
What solutions have you tried so far?
Couldnt find anything talking about it
local player = game:GetService("Players").LocalPlayer
game:GetService("Players").PlayerAdded:Connect(function(plr)
plr:SetAttribute("Sanity", 100)
end)
player:SetAttribute("Sanity", 100)
Like other people have said, do this on the server, not the client.
The reason this doesn’t work is that the code loads after the player connects to the server. So the PlayerAdded event triggeren when the client joins, can never be received by the client itself.