Help with Player Detection and Humanoid:MoveTo

Hi, So I need help trying to move a player when a certain part isn’t detected, So basically there is this line


and I want it where if a player has touched the line, then the player will move up if no humanoid is detected. But when I do it, it doesn’t work. Here is the script below


local function onTouch(hit)
	if (hit.Parent:FindFirstChild("Humanoid")~= nil) then
		print("Player has been inserted in line")
		hit.Parent.Humanoid.WalkSpeed = 0
		hit.Parent.Humanoid.JumpPower = 0
		wait(2)
		if hit.Parent.Humanoid then
			hit.Parent.Humanoid:MoveTo(Vector3.new(0.08, 0.275, -43.93))
		else
			hit.Parent.Humanoid.WalkSpeed = 0
			hit.Parent.Humanoid.JumpPower = 0
		end
	end
end

script.Parent.Touched:Connect(onTouch)

Please help me with this so I can get an understanding.

You’re setting walkspeed to 0, then calling MoveTo, so the player cant move to that position.

Okay Thanks, I will try and see if it works

30 characters