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?
01 | speed = 5000 |
02 |
03 |
04 | wait( 10 ) |
05 | local startingPos = game.Workspace.Elevator.Position |
06 | local endingPos = game.Workspace.Elevator.Position + Vector 3. 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 ) |
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:
01 | local elevator = script.Parent |
02 | speed |
03 | local bodyvel = Instance.new( "BodyVelocity" , elevator) |
04 | bodyvel.Velocity = Vector 3. new( 0 , 0 , 0 ) |
05 | local bodygyro = Instance.new( "BodyGyro" , elevator) |
06 | local startingpos = elevator.Position |
07 | local endingpos = elevator.Position + Vector 3. new( 0 , - 30 , 0 ) |
08 | --Now we make the elevator go up to the ending position |
09 | while true do |
10 | wait() |
11 | bodyvel.Velocity = Vector 3. new( 0 , - 1 , 0 ) -- you can change the -1 to whatever speed you want |
12 | if elevator.Position = = endingpos then |
13 | bodyvel.Velocity = Vector 3. new( 0 , 0 , 0 ) |
14 | end |
15 | end |
Also, please, for the sake of god, don't use game.Workspace when working with these things