I am finishing up my game and I want it to reset the stats from the leaderboard back to default numbers once I travel through the final teleport. I can't understand why it isn't working. Here is the script I have so far.
local plr = game.Players:GetPlayerByUserId() script.Parent.Touched:connect(function(hit) if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then local Lives = plr.leaderstats.Souls; local Stage = plr.leaderstats.Stage; local Time = plr.leaderstats.Time; Lives.Value = 25 Stage.Value = 0 Time.Value = 0 end end)
Consider changing to GetPlayerFromCharacter as follows:
function hit(hitter) if hitter.Parent:FindFirstChild("Humanoid") then local plr = hitter.Parent:GetPlayerFromCharacter() --You can do the lives and other stats here end end script.Parent.Touched:connect(hit)
Hope this helped