I just started Lua five days ago and I did a little bit of research and I am making a difficulty chart obby. I am making my leaderboard for the obby which tells you which stage you are on and which difficulty you are on. When I tested my leaderboard out in the studio with two players, when one player stepped on the first checkpoint, the leaderboard updated for all players. Is there any way I can fix this? I will show my code down below. Help is very appreciated and thank you in advanced. :)
local players = game:GetService("Players")
players.PlayerAdded:Connect(function(player)
if player then
local folder = Instance.new("Folder")
folder.Name = "leaderstats"
folder.Parent = player
local stage = Instance.new("IntValue")
stage.Name = "Stage"
stage.Parent = folder
stage.Value = 0
local DifficultyChart = Instance.new("StringValue")
DifficultyChart.Name = "Level"
DifficultyChart.Parent = folder
DifficultyChart.Value = "None"
local checkpoint1 = game.Workspace.Checkpoint1
checkpoint1.Touched:Connect(function(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid then
stage.Value = 1
DifficultyChart.Value = "Too EZ"
local checkpoint2 = game.Workspace.Checkpoint2
checkpoint2.Touched:Connect(function(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid then
stage.Value = 2
end
end)
end
end)
end
end)

2 comments
Wow! That was a good explanation. I watched a tutorial on remote events by TheDevKing and I can see what you mean. I will try to implement what you told me into my code and I hope I can learn developing with you. Thank you so much for answering I really appreciate it! Have a good day :D
I have tried doing what you told me to and it worked! Thank you so much!