Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Model glitching when using :MoveTo?

I am making an elevator and when I call the first :MoveTo it moves up about 2-4 studs and then immediately continues the script and works flawlessly after. The reason I have a problem with this is that it teleports the player under the elevator ending with them plummeting into the void! I don't know if another method of moving the model would fix the problem or if its a completely different problem. Thanks for your help!

local Bumper = script.Parent
local Elevator = script.Parent.Parent.Parent
local debounce = false

Bumper.Touched:Connect(function(hit)
	if debounce == false then
		if hit.Parent.Name == "Cart" then
			debounce = true
			wait(0.5)
			local EleYCheck = 14.2
			while EleYCheck ~= 64.2 do
				EleYCheck += 0.01
				Elevator:MoveTo(Vector3.new(-15.587, EleYCheck, -42.972))
				wait(0.01)
			end
			wait(10)
			while EleYCheck ~= 14.2 do
				EleYCheck -= 0.01
				Elevator:MoveTo(CFrame.new(-15.587, EleYCheck, -42.972))
				wait(0.01)
			end
			wait(3)
			debounce = false
		end
	end
end)

1 answer

Use TweenService to slowly move the elevator. I believe your issue is that the player is not moving with the elevator and gets glitched under, you could do that or use :MoveTo on the player aswell.

This discussion is preserved as it was. New answers, comments, and votes are closed.