So, I'm making a game where, after a random number of seconds, a block dissapears, in the air, with the player on it. I need the player to fall, but it floats in the air, meaning that the part just turns transparent, it doesn't disappear. Here is my current code:
1 | Part = script.Parent -- the part |
2 |
3 | while wait (math.random ( 1 , 3 ) ) do -- repeat this loop every (random) seconds |
4 | Part.Transparency = 1 |
5 | wait(math.random( 1 , 5 )) -- wait between 1 to 5 seconds |
6 | Part.Transparency = 0 |
7 | end |
I need the player to fall. Can you help me? Thanks!
You need to change the CanCollide property of the part along with the transparency. This property decides whether or not a player can collide with a part. Here is the previous answer taking that into account;
1 | Part = script.Parent -- the part |
2 |
3 | while wait( 14 ) do -- repeat this loop every 14 seconds |
4 | Part.Transparency = 1 |
5 | Part.CanCollide = false |
6 | wait(math.random( 6 , 12 )) -- wait between 6 to 12 seconds |
7 | Part.Transparency = 0 |
8 | Part.CanCollide = true |
9 | end |