Player wont move with tweened part

  1. What do you want to achieve? So I have my tweened part working fine, but I want the player to move with it.

  2. What is the issue? When you go on the part, it slides out from under you.

  3. What solutions have you tried so far? I don’t know what to try.
    Any help would be apreciated

1 Like

You can use the code in the solution to this post, you’ll just have to modify it a bit to match your needs.

2 Likes

Maybe try changing the friction, so that it doesn’t slide out?

1 Like

How about using BodyPosition and BodyGyro instances instead of tweening? Repeatedly updating a position (like with tweening) will not move things with it, but BodyPosition applies a force to an object to get it to a position, which affects things on top of it and in its path.

2 Likes

As @MuPower suggested, you can’t do it because you are CFraming the part, not moving it physcially. Think of CFraming as teleporting the object, not moving it. Even if it tweened the Part is not actually moving.
Imaging a flipbook type of animation using a bunch of drawings on each page of a notebook. Each drawing is different, but only because you are flipping it ‘frame by frame’ does it look like the animation is moving.
Try using a PrismaticConstraint or a BodyPosition to move your Part.

1 Like

How would I do this? May you print an example?

Try something like this:

function ReachedTarget(platform,targetPosition)

return (platform.Position - targetPosition).Magnitude <= .75

end

local speed = 10 --- set the speed of your platform

local waitTime = 3

local model = ("Model ur using")

local platform = ("Platform to be moved in the model")

local start = ("Create a part or Position where it starts at")

local finish = ("Create a part or Position where it starts at")

local direction = finish.Position - start.Position ---- If ur making it move to parts or just use Vectors for Positions

platform.Anchored = true -- make it anchored so it dosent move

local BV = Instance.new("BodyVelocity")

BV.MaxForce = Vector3.new(400000, 400000, 400000)

-- U can change the Body Velocities Power but for now it will stay at its default which is fine

BV.Velocity = Vector3.new(0,0,0)

local BG = Instance.new("BodyGyro")

BG.D = 500

BG.MaxTorque = Vector3.new(400000, 0, 400000)

BG.P = 3000

local BA = Instance.new("BodyAngularVelocity")

BA.AngularVelocity = Vector3.new(0,0,0)

BA.MaxTorque = Vector3.new(40000, 40000, 40000)

BA.P = 1250

BV.Parent = platform

BG.Parent = platform

BA.Parent = platform

platform.Position = start.Position --- set its Position to the Start Position

repeat task.wait() until BV.Parent

while true and platform ~= nil do

BV.Velocity = direction.Unit * speed

repeat task.wait() until ReachedTarget(platform,finish.Position)

BV.Velocity = Vector3.new()

task.wait(waitTime)

BV.Velocity = direction.Unit * speed * -1

repeat task.wait() until ReachedTarget(platform,start.Position)

BV.Velocity = Vector3.new()

task.wait(waitTime)

end

Here’s a model I built for someone else on another post to show them how a PrismaticConstraint could be used for a platform system:
<PlatformModel - Roblox
The button at the stairs moves the platform to one end, pauses, then moves back. You can script it however you want though.

2 Likes

Thank you!

I have a few questions though.

Why is it so complicated just to get a part to move? is the torque part really necessary?

Thank you - Ill check it out! :grinning: