#How can I make players stick to moving parts?

1 messages · Page 1 of 1 (latest)

unkempt vigil
#

I'm trying to make some sort of a train for my game and when the train starts to move players just noclip through it and dont even stick on it
If it helps I'm using CFrames with TweenService to make the train move

celest mountainBOT
#

studio** You are now Level 1! **studio

unkempt vigil
warped turret
#

You can use AssemblyLinearVelocity,

unkempt vigil
#

how do I do that? 👀

#

I havent really used it before

warped turret
#

Its basically just a property of a basepart

#

In the video, he is tweening the part and all however, he is also changing the assembly linear velocity

#

by finding the offset for each heartbeat, and updating the speed depending on the distance the part moved

unkempt vigil
#

Okay I'll try to implement that into it

#

hopefully it works

warped turret
unkempt vigil
#

okay with the guide I got it to work :)
thanks

unkempt vigil
#

hey @warped turret do you maybe know how I could make more carts to the train?
I tried to somehow make the tween service set the CFrame of the 2nd platform to the main platform but it didnt really work

#

there was a huge gap between them

warped turret
#

Can you show the code?

unkempt vigil
warped turret
#

imma read it in a min

#

one sec

#

its probably because you're not tweening them at the same time

unkempt vigil
#

oh

#

imma try that

warped turret
#

hmm

warped turret
# unkempt vigil

Yup @unkempt vigil you are waiting 1 second between each tween

unkempt vigil
#

oh but I noticed that if I tweened the cart to the main platform then when the main platform would stop the cart would just go into it

#

how do I avoid that?

warped turret
#

one sec

#

just make sure there is always an offset

#

or like -1 position

#

of the part infront of it

#

if you're storing positions in a table

unkempt vigil
#

I'm not storing them in tables

celest mountainBOT
#

studio** You are now Level 2! **studio

warped turret
#

like the child number

unkempt vigil
#

how do I do that exactly? 👀

#

wait would it be a good idea to try adding an int value to the main platform and have the cart part go to the checkpoint that is -1 of the value?

warped turret
#

like number 1

#

number 2

#

etc

unkempt vigil
#

yeah its for these things

warped turret
#

and you have position in the folder?

unkempt vigil
#

yeah

#

but rn I'm storing them in the script only

#

that could probably work but I would need to add more points for the stations

warped turret
#

Like I don't get what you are trying to achieve exactly

#

are the carts colliding with eachother

#

or are they colliding with the main platform itself

unkempt vigil
#

no its that I dont really know how to add carts to the train

#

and when I tried to do it there were huge gaps

warped turret
#

Oh, look you're gonna tween them all the same time, however you're gonna tween them to position of the cart infront of them

#

so lets say the cart infront of them is at 20

#

the next cart will move at 20

#

the cart infront of it

#

will move to 21

#

and you decrement for each cart

#

but in your example

#

lets say the main cart is moving to 20?

unkempt vigil
#

ye

warped turret
#

and lets say your train has 10 carts

#

the final cart would move to 10

#

but you must tween them all at the same time

unkempt vigil
#

but when the train would stop wouldnt the carts just go into one another?

warped turret
#

they would be always offseted by 1 checkpoint so to say

unkempt vigil
#

oh

#

could I achieve the same by making some sort of value in the 1st platform to the number and then have the carts go to the -1 of that value?

warped turret
unkempt vigil
#

oh yeah

#

I'll try that

#

nice it works :)

#

thanks

warped turret
#

np