I am building an obby. I am using 2 scripts to make the checkpoints. Here they are: Script I put in ServerScriptStorage

game.Players.PlayerAdded:connect(function(Player)
 local Ls = Instance.new('IntValue',Player)
 Ls.Name = 'leaderstats'
 local Level = Instance.new('IntValue',Ls)
 Level.Name = 'Level'
 Level.Value = 1
 Player.CharacterAdded:connect(function(Character)
  repeat wait() until Character ~= nil
  local Stage = game.Workspace.Stages:FindFirstChild(Level.Value)
  Character:WaitForChild('HumanoidRootPart').CFrame = Stage.CFrame + Vector3.new(0,5,0)
 end)
end)

Script for Checkpoint

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		if game.Players:FindFirstChild(hit.Parent.Name) then
			local Player = game.Players:FindFirstChild(hit.Parent.Name)
			local Level = Player:WaitForChild("leaderstats"):WaitForChild("Level")
			if Level.Value == script.Parent.Name -1 then
				Level.Value == script.Parent.Name 
			end
		end
	end
end)

5 comments

0

The parent argument of Instance.new() is deprecated. Assign the parent in a new line and please indent the code in the first script properly. Also, are you getting any errors?

0

No, not getting any errors.

0

line 07 of script for checkpoint: Level.Value = script.Parent.Name

0

You can't perform arithmetic on a string value. "script.Parent.Name - 1"

0

if that didn't give you errors then the levels value isn't the same as script.Parent.Name and what is line 6 even suppose to mean??