I have this script, and the line it breaks on is "player.leaderstats.points.Name = player.leaderstats.Credits + 200" The reason is the stats on the leader are points but are named under Credits.
This is the script:
game.Workspace.ChildAdded:connect(function(child) if child.Name == "HostageFree" then script.Sound:Play()--Don't worry about here and above for _,player in pairs(game.Players:GetPlayers()) do if player.TeamColor == BrickColor.Red() then player.leaderstats.points.Name = player.leaderstats.Credits + 200 --Broken line wait(7) --Don't worry about here and below local pl = game.Players:GetChildren() for i=1,#pl do pl[i].Character.Humanoid.Health = 0 game.Workspace.HostageFree:Remove() end end end end end)
NOTICE: the leaderboard stat is points but I named them Credits so when it appears on players leaderboard ingame it appears as Credits but still is referred to as points in script. But you have to add +200 to Credits
game.Workspace.ChildAdded:connect(function(child) if child.Name == "HostageFree" then script.Sound:Play()--Don't worry about here and above for _,player in pairs(game.Players:GetPlayers()) do if player.TeamColor == BrickColor.Red() then player.leaderstats.Credits.Value = player.leaderstats.Credits.Value + 200 --Broken line wait(7) --Don't worry about here and below local pl = game.Players:GetChildren() for i=1,#pl do pl[i]:LoadCharacter() -- This is a faster way of resetting them. If you've ever used an admin script, this would be the equivalent of :Respawn [person] game.Workspace.HostageFree:Destroy() -- use destroy whenever possible. end end end end end)
Fixed it myself :p
game.Workspace.ChildAdded:connect(function(child) if child.Name == "HostageFree" then script.Sound:Play() for _,player in pairs(game.Players:GetPlayers()) do if player.TeamColor == BrickColor.Red() then local leaderstats = player.leaderstats local points = leaderstats:findFirstChild("Credits") points.Value = points.Value +200 wait(7) local pl = game.Players:GetChildren() for i=1,#pl do pl[i].Character.Humanoid.Health = 0 game.Workspace.HostageFree:Remove() end end end end end)