for i,v in pairs(workspace.Levels:GetChildren()) do

	if v.ClassName == "Part" then

		v.Touched:Connect(function(object)
			local d = object.Parent:FindFirstChild("Humanoid")
			if d then
				local player = game.Players:GetPlayerFromCharacter(object.Parent)
				if v.Name == "Level1" then
					if player.leaderstats.Levels.Value == 0 then
						SetCheckpoint(player,v)
						print("set checkpoint")
					end
				end
				if v.Name == "Level2" then
					if player.leaderstats.Levels.Value == 1 then
						SetCheckpoint(player,v)
						print("set checkpoint")
					end
				end
			end
		end)
	end
end

So I am trying to check if the Levels.Value for the player is equal to what I entered but when I test the script and the Levels.Value for the player is the same nothing is happening and the function SetCheckpoint is not working.

1 comment

1

Can you post a screenshot of your explorer tab?