I’m working on a TF2 inspired Roblox game and I’m currently trying to make a Payload gamemode for it. The issue is I have no idea where to start with this one.
Pretty much I’m trying to make a script that moves a model to certain parts in a sequence, once the model reaches one part it starts to move to another one. And I also want to make it so the cart only moves if a player is standing near it. (& who is on a specific team preferably)
– ive also still gotta make a script where if the cart moves over a specific pad the game will have more time added to it, but this isn’t my main priority right now. –
I don’t know exactly how I’d achieve this, I haven’t seen a lot of posts going into depth on how to keep a model at its last position when you step away from it, which is sort of preventing me from writing any code of my own. (And I don’t know if I should use tweens or gradually moving the models cframe.)
I’m not looking for a full script to immediately slam into my game, I really just need some examples I can branch off of.
Well it really depends on how you are moving the model. Ultimately you need to check every player to see if they are in range and stop the model if not or start/continue if they are.
The simplest form of implementation is like
while true do
if IsAnyPlayerInRange() then
movePart1Step()
end
end
Other things like using tween service could technically work, but you need to have it start and stop based on a query loop that always runs. So when the loop sees nobody it calls stop and when it sees someone it calls start.
I actually found a good way to do this with tweens using a Touched function. I thought that tweens are very complicated but it turns out they’re quite simple! I think i’m good to make the rest of this code myself, thanks for the help y’all.