i want to make a part that can change the value of a leaderstat and set it to a certain value without adding to it but for instead it just sets it to the value i want it to change to when the brick is touched
game.Players.PlayerAdded:connect(function(player)
script.Parent.Touched:connect(function()
local plrstats = player.leaderstats.stage
plrstats.Value = 1
end)
end)
i am not sure what is wrong with it here. and i tried this as well
game.Players.PlayerAdded:connect(function(player)
script.Parent.Touched:connect(function()
local plrstats = player.leaderstats.stage
plrstats.Value = plrstats.value = 1
end)
end)
but that didnt work either

2 comments
You don't need to use PlayerAdded in this. You can get whatever part touched it by putting a variable in the parameters since it passes it. So just check if that is a player and increase their stage
its useless putting .Touched when the player joins, use plrstats.Value = plrstats.Value + 1