Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Humanoid falls through moving block?

Asked by 7 years ago

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?

01speed = 5000
02 
03 
04wait(10)
05local startingPos = game.Workspace.Elevator.Position
06        local endingPos = game.Workspace.Elevator.Position + Vector3.new(0,30,0)
07        local elevator = game.Workspace.Elevator
08 
09        for ratio = 0,speed,5 do
10            local newPosition = startingPos:lerp(endingPos, ratio/speed)
11            elevator.Position = newPosition
12            wait()
13        end
14 
15        wait(10)
View all 25 lines...

1 answer

Log in to vote
1
Answered by 7 years ago

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:

01local elevator = script.Parent
02speed
03local bodyvel = Instance.new("BodyVelocity", elevator)
04bodyvel.Velocity = Vector3.new(0, 0, 0)
05local bodygyro = Instance.new("BodyGyro", elevator)
06local startingpos = elevator.Position
07local endingpos = elevator.Position + Vector3.new(0, -30, 0)
08--Now we make the elevator go up to the ending position
09while true do
10    wait()
11    bodyvel.Velocity = Vector3.new(0, -1, 0) -- you can change the -1 to whatever speed you want
12    if elevator.Position == endingpos then
13        bodyvel.Velocity = Vector3.new(0, 0, 0)
14    end
15end

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

Ad

Answer this question