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

Why doesn't the player move with the new block position?

Asked by 9 years ago
randPlat.Position = randPlat.Position + Vector3.new(0, 1, 0)

The random platform is supposed to move one stud up, but when a player steps on the platform while it moves, the platform will just move on top of the player's head. How would you make it so that the player moves with the new block position?

2 answers

Log in to vote
2
Answered by
joalars2 107
9 years ago

You are setting the plate's Position, consider using CFrame instead.

Position moves the brick upwards if it is obstructed by anything.

CFrame moves the brick to exactly where you want it, obstructed or not.

Here's a fixed version of your code.

randPlat.CFrame = randPlat.CFrame + Vector3.new(0, 1, 0)

Tell me if its still broken ^^

Ad
Log in to vote
1
Answered by 9 years ago

This is one way to do it. However if your plateform is like an elevator in a enclosed shaft I would not recommend using CFrame at all. Use a body position instead. Just insert a bodyposition and bodyGyro into the platform.

randPlat.BodyPosition.Position =  Vector3.new(0, 1, 0)

Tell me if this doesn't work.

Answer this question