Hello! I am trying to make a script that gives you a point when you are between 100 and -5 on the y axis. There is no error in the output, but I still dont get any points. The only scoreboard objectives are Points and High Score. Here is the code I am using.
while wait(2.1) do
if Workspace.Running.Value == true then
for _,Player in pairs(game.Players:GetPlayers()) do
for i,v in pairs(Workspace:GetChildren()) do
if v.Name == Player.Character then
player = v
if Player:FindFirstChild("leaderstats") then
leaderstats = Player.leaderstats
points = leaderstats:FindFirstChild("Points")
highscore = leaderstats:FindFirstChild("High Score")
if player.Torso.Position.y < 100 and player.Torso.Position.y > -5 then
points.Value = points.Value + 1
if points.Value > highscore.Value then
highscore.Value = points.Value
end end end end end end end end
Hopefully you can help!

3 comments
I forgot that you could do that... :P Thanks though! And I don't really know why I did all those ends...
The ends were necessary, I was just asking why they were all on a single line. :P
yeah, thats what I meant. I don't know why I put all those ends on one line