local plrs = game:GetService("Players")
local Rs = game.ReplicatedStorage
local CheckpointEV = Rs.CheckpointEv
local part = game.Workspace.Part
plrs.PlayerAdded:Connect(function(plr, leaderstats)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
local Checkpoint = Instance.new("IntValue", leaderstats)
Checkpoint.Name = "Checkpoint"
Checkpoint.Value = 0
end)
CheckpointEV.OnServerEvent:Connect(function(plr)
part.Touched:Connect(function()
local leaderstats = plr:WaitForChild("leaderstats")
if leaderstats then
local CheckPoint = leaderstats:WaitForChild("Checkpoint")
if CheckPoint then
CheckPoint.Value += 1
end
end
end)
end)
That one handles the leaderstats logic
this one handles firing the event, it is a localscript in sps:
local part = game.Workspace.Part
local CheckpointEV = game.ReplicatedStorage.CheckpointEv
part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
CheckpointEV:FireServer()
end
end) ```