Detecting If One Axis Is Invalid

I need help detecting if one axis is invalid!

  • Bassicly i want to be able to detect if a players Z axis is not valid to game.Workspace:FindFirstChild(“Lane”…lane)

  • The ‘lane’ variable is a number

  • I want the humanoidrootpart to get detected whenever its Z axis is invalid to the lane

  • Heres The Current part of the script:

game["Run Service"].RenderStepped:Connect(function()
	
	if moving == false then
		
		if char:WaitForChild("HumanoidRootPart").CFrame ~= CFrame.new(char.HumanoidRootPart.CFrame.X, char.HumanoidRootPart.CFrame.Y, game.Workspace.Game:FindFirstChild("Lane"..lane).CFrame.Z) then
			
			
			
		end
		
	end
	
end)

I only need help with the “if char:WaitForChild()” part but if possible fill in the rest :smiley: -

The goal here is not very clear. Are you requesting how to check if the player’s angle (along the Z axis) clashes with a particular lane?

im trying to check if a player’s z axis is not valid to the workspace lane z axis

Okay, but what do you mean “not valid”? All positional values are valid, do you mean if the Z axis does not equal a particular value, in this case the lane?

i mean if the players humanoidrootpart position does not equal to the lane z axis

Do you want it to be exact or have some leeway? Hint: If it’s an exact check, the character will pretty much never be aligned with the lane according to the script.