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

Humanoid falls through moving block?

So I'm still having trouble this one. Its a timed block that acts like an elevator. Players keep falling through it though and Can Collide is checked. How do I keep them from falling through?

speed = 5000


wait(10)
local startingPos = game.Workspace.Elevator.Position
		local endingPos = game.Workspace.Elevator.Position + Vector3.new(0,30,0)
		local elevator = game.Workspace.Elevator

		for ratio = 0,speed,5 do
			local newPosition = startingPos:lerp(endingPos, ratio/speed)
			elevator.Position = newPosition
			wait()
		end
		
		wait(10)
		
		local startingPos = game.Workspace.Elevator.Position
		local endingPos = game.Workspace.Elevator.Position + Vector3.new(0,-30,0)
		local elevator = game.Workspace.Elevator

		for ratio = 0,speed,5 do
			local newPosition = startingPos:lerp(endingPos, ratio/speed)
			elevator.Position = newPosition
			wait()
		end

1 answer

✓ Accepted answer

Players keep falling through because of the player clipping through the elevator. I suggest you using BodyVelocity to move the elevator and BodyGyro to keep the elevator rotation. It is a much easier way and it works much better Here's an example:

local elevator = script.Parent
speed 
local bodyvel = Instance.new("BodyVelocity", elevator)
bodyvel.Velocity = Vector3.new(0, 0, 0)
local bodygyro = Instance.new("BodyGyro", elevator)
local startingpos = elevator.Position
local endingpos = elevator.Position + Vector3.new(0, -30, 0)
--Now we make the elevator go up to the ending position
while true do
	wait()
	bodyvel.Velocity = Vector3.new(0, -1, 0) -- you can change the -1 to whatever speed you want
	if elevator.Position == endingpos then
		bodyvel.Velocity = Vector3.new(0, 0, 0)
	end
end

Also, please, for the sake of god, don't use game.Workspace when working with these things

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