Roblox - Make a Moving Platform that Moves Players

Поделиться
HTML-код
  • Опубликовано: 3 окт 2024
  • In this video, we will explain how to create a moving platform that moves players.
    This is great for anyone who is making an obby game, or making a training base for their group!
    Get your assets: theletusgarden...
    Join our discord server: / discord

Комментарии • 207

  • @alonepoptart24_6
    @alonepoptart24_6 Год назад +11

    finally a moving platform script that ACTUALLY works with the studio update
    thank you

  • @Cosmetic7000
    @Cosmetic7000 2 года назад +22

    This is some very simple code that helped me create a part that hit the player off the map in my game. This was very useful, ty!

    • @footyup314
      @footyup314 2 года назад +2

      bro how is this simple to you

    • @Cosmetic7000
      @Cosmetic7000 Год назад +15

      @@footyup314 Its programming. Its simple. If you don't learn, it won't look simple to you but if you have experience, you would know this is very simple and short.

  • @GemVR
    @GemVR Год назад +6

    if you dont want to make the script
    and your lazy use this local TweenService = game:GetService("TweenService")
    local RunService = game:GetService("RunService")
    local part = script.Parent
    local tweenInfo = TweenInfo.new(2, Enum.EasingStyle.Cubic,Enum.EasingDirection.InOut, -1, true)
    local tween = TweenService:Create(part, tweenInfo, {
    CFrame = part.CFrame * CFrame.new(0, 0, -10)
    })
    tween:Play()
    local lastposition = part.Position
    RunService.Stepped:Connect(function(_, deltaTime)
    local currentPosition = part.Position
    local deltaposition = currentPosition - lastposition

    local velocity = deltaposition / deltaTime

    part.AssemblyLinearVelocity = velocity

    lastposition = currentPosition

    end)

  • @tonicmerchs0599
    @tonicmerchs0599 2 года назад +6

    Glad to see you're back! It's been forever

  • @divertedtraffic9327
    @divertedtraffic9327 2 года назад +7

    He finally uploads again!!!

  • @45_Kiwi
    @45_Kiwi Год назад +2

    This helped alot. thank you!

  • @qrisquinn
    @qrisquinn 2 года назад +2

    He has returned! Great video. Will you be continuing the force series? I really wanted to learn how to do the rest.

    • @TheLetusGarden
      @TheLetusGarden  2 года назад +2

      I'm not sure
      I'd like to plan it out a bit more and have some cleaner code. The current force videos aren't great imo

  • @NaNStudios
    @NaNStudios 4 месяца назад

    Even after 2 years, it's still helpful!

  • @baconpoutine8923
    @baconpoutine8923 2 года назад +1

    Return of the king 👑

  • @kahunastudios4738
    @kahunastudios4738 4 месяца назад

    Great tutorial! You helped solve my problem with moving the player with the platform. Prior to this video, I watched 3 others but they did not help. Quick question: I am assuming updating the platform's AssemblyLinearVelocity property applies that delta to any object that is touching it?

  • @handle-g2
    @handle-g2 2 года назад +19

    thing is.. when the player moves with the platform it isnt smooth

    • @alexjbgaming
      @alexjbgaming Год назад +9

      It’s just lag 😅😅😅😅 all games are like that depending on your lag they all use the sm we script there isn’t a different script to do this with 😅😅😅😅😅

    • @laspy9915
      @laspy9915 Год назад

      @@alexjbgaming actually I have a pretty solid computer but after I placed a couple of them it started moving weird it’s not lag it’s bad code

    • @DwnOfficial
      @DwnOfficial Год назад +2

      Try making it via local script

    • @GiftyOff
      @GiftyOff Год назад

      Its roblox movement delay

    • @GiftyOff
      @GiftyOff Год назад

      Cant fix it

  • @gabegamez1018
    @gabegamez1018 Год назад

    Thanks for helping me with tweenservice! Now I can make my elevator game!

  • @stopmotionmanga
    @stopmotionmanga Год назад

    thanks you I was trying to use TweenService but that wasn't working and I wasn't finding a good tutorial, because other tutorials keep saying "copy and paste the code in description" and I wanted to learn how to do this codes and your tuto was perfect, thanks you

  • @laspy9915
    @laspy9915 Год назад +5

    This was great! But I can just Change the z variables To change how far the platform moves but how do I change how fast it goes maybe changing the time to move back-and-forth?

    • @SummitRoblox
      @SummitRoblox Год назад +1

      Hey! So if you look in the code it is the 2 in there! Hope that helps!

    • @zeplexgamingyt9639
      @zeplexgamingyt9639 Год назад +1

      @@SummitRoblox this helped me thanks idk if the other guy heard this tho

  • @allusionistw
    @allusionistw 2 года назад +5

    One question that I have, does RunService.Stepped impact performance? since it's running every physics update constantly updating values would it cause any hinderance to performance with multiple platforms?

    • @TheLetusGarden
      @TheLetusGarden  2 года назад +2

      It would if you were running intense code. In this example, the core that we are running is very light, so performance isn’t much of an issue

    • @avinath1
      @avinath1 2 года назад +3

      @@TheLetusGarden exactly that’s the problem. In THIS PARTICULAR INSTANCE what you are running is very light. People are looking at this video to use it in their game which will obviously include other things than this. Running on inefficient code will not benefit anybody. You should have used align position and align orientation objects to keep the player centered on the object rather than a run service which is highly inefficient and more complex.

    • @puresk1111
      @puresk1111 2 года назад +2

      @@avinath1 quick idea just don’t calculate huge code inside the Stepped event and put it aside into a delayed while task.wait(anyDelayedTime) and parallel only update the AssemblyLinearPosition of your platform or moving part to let the players' characters stand still on the part
      Edit: Also amazing video it helped me to solve that issue with standing on the platform

    • @avinath1
      @avinath1 2 года назад

      @@puresk1111 it’s still not efficient

  • @auraborus361
    @auraborus361 Год назад +14

    Short and sweet. Nice instructional that works!

  • @SaturnMist4
    @SaturnMist4 Месяц назад

    please put your assets in the description; i cant enter your website since it takes way too long to load and the connection times out.

  • @splashy2152
    @splashy2152 6 месяцев назад

    THANK YOU SO MUCH AAAAAA 😆

  • @zinvious
    @zinvious 5 месяцев назад +1

    With the same method, how would you go about rotating platforms? changing the Linear Velocity based on the position won’t work anymore because the platform is not actually moving, and changing the Angular Velocity won’t do anything but spin the player xd HELP PLS

  • @carlzyrusmariano9530
    @carlzyrusmariano9530 2 года назад +1

    thank you! you earned a sub and like from me

  • @pengidev4553
    @pengidev4553 2 года назад +14

    I've been trying to figure out this issue for a bit now and you solved it! Recently, bodymovers were deprecated and I didn't want to learn the new Velocity things lol.

    • @avinath1
      @avinath1 2 года назад +6

      You should tho. Align position and align orientation are quite simple and in a game using this method that he used in the video would not be efficient at all. His run service method is bad as it’s inefficient and runs code every frame. Learn the position and orientation align objects, trust me.

    • @pengidev4553
      @pengidev4553 2 года назад +1

      @@avinath1 Yea, I got that under my belt since last month now lol. Compared to before, align pos/orientation are wayy better than this.

    • @avinath1
      @avinath1 2 года назад +1

      @@pengidev4553 I’m still trying to understand it. Could you make a video on it please?

    • @animatnetic2545
      @animatnetic2545 Год назад

      @@avinath1 It is quite efficient acc. To be honest, I find AlignPositon really hard to use.

  • @yerielfilms
    @yerielfilms 2 года назад +4

    how do i make it faster ?

  • @PixelCharly
    @PixelCharly 10 месяцев назад

    thank you so much

  • @Nixo77
    @Nixo77 Год назад

    Tysm this works

  • @retrobruvver6594
    @retrobruvver6594 Год назад +1

    isnt working :/

  • @IcyColdDve
    @IcyColdDve 2 года назад +2

    YESSIR MAN ITS BEEN LONG

  • @jackt6866
    @jackt6866 Год назад +1

    It isn’t smooth but it works so it’s better than a the other like 7 videos I was trying to use

  • @juicejosh1520
    @juicejosh1520 Год назад +1

    How would you go about rotating the part in circles?

  • @mrhenio6106
    @mrhenio6106 Год назад +1

    Does't work

  • @Zarigueya_123
    @Zarigueya_123 3 месяца назад

    you sound like jerma

  • @mikeschmidt9784
    @mikeschmidt9784 2 года назад +3

    Thank you, it was useful

  • @jonnan7539
    @jonnan7539 Год назад +1

    How to make it so that the platform doesnt wait so long before returning?

  • @iedgaming
    @iedgaming 2 года назад +2

    YOOOOO LETUS IS BACK

  • @doubleg5573
    @doubleg5573 2 года назад +1

    Is it normal that TweenService isn't the smoothest "annimation" you can do? Because the part is shaking when I activate the tween.

  • @coldcatarchives
    @coldcatarchives 2 года назад +2

    how do i make this script but make it move an entire model? im trying to make a moving cargo plane where the player is inside and can jump out without sliding out when it starts moving

    • @theclumsydweeb815
      @theclumsydweeb815 2 года назад +2

      Make it union unless you want make individual part move

    • @ImJamieX
      @ImJamieX Год назад +1

      create a part and name it "Center" or "Main" and put it in the center of your model(add it to model instance too), make sure it IS ANCHORED. then unanchor ALL other parts of your model and weld each one to your "Center/Main" part. then while tweening you only have to tween 1 part.. Very useful for dropships. (all you have to do to make players NOT slide out is weld their rootpart to the same Center/Main part, then destroy weld on button press (space)

    • @oteupaiaquelecara
      @oteupaiaquelecara Год назад

      @@ImJamieX thx

  • @justgulle3976
    @justgulle3976 2 года назад +1

    tysm

  • @duckgamer67
    @duckgamer67 2 года назад +2

    thx

  • @Friendly.NetWork
    @Friendly.NetWork Год назад

    Thank you... is work.... but do you think? Have a way to fix the refresh rate...my platform moves 40 on the X axis and you can see it shakes a little... but anyway thank you.

  • @aylarahimaa
    @aylarahimaa 2 года назад +1

    hey can you help me how to make a endless moving platform

  • @takutokawai
    @takutokawai Год назад +1

    Does this still work now?

  • @misatoshi
    @misatoshi 8 месяцев назад

    Hello, but it always happens to me that in the part where you put Runservice that word is marked in blue

  • @Kinoparapino
    @Kinoparapino 6 месяцев назад

    My part just moves but doesnt move the player with it. Can somebody copy and paste the script?

  • @oberonpanopticon
    @oberonpanopticon Год назад +1

    It’s 4 AM so I’m not absorbing much and can’t test this out for myself rn, but assuming it works this seems like it’s a really good tutorial!

  • @vladkamael
    @vladkamael Год назад +1

    It's cool and all, but everything, expect the player, still ignores my elevator platform.
    Making like a portal inspired puzzle chamber and my cubes don't move with the elevator.
    Instead they stay down and "update" their position only when player touches them.
    But even then - they still do it wrong and go like, half way and not to the top.

    • @placeholder4675
      @placeholder4675 7 месяцев назад

      How about welding (Motor6D) the cubes to the elevator when they're in the elevator, but not being touched?

    • @vladkamael
      @vladkamael 7 месяцев назад

      ​@@placeholder4675 We used "align position" thing in the end. Kinda worked.

  • @progaming915
    @progaming915 2 года назад +3

    can u link the script?

  • @codingwithpro276
    @codingwithpro276 2 года назад +1

    src code

  • @guy56890
    @guy56890 2 года назад +1

    been forever!

  • @RiddleWiz368
    @RiddleWiz368 2 года назад +1

    yo hes alive

  • @darklordofdaporg655
    @darklordofdaporg655 2 года назад +1

    He's alive?

  • @aptmatter
    @aptmatter 2 года назад +1

    WE BACK BABY!!

  • @Roblo1938
    @Roblo1938 9 месяцев назад

    Can I turn it into a thing for my horror game?

  • @smoothi14
    @smoothi14 8 месяцев назад

    How do you make it go to a specific spot?

  • @CosmicMaanz
    @CosmicMaanz 2 года назад +1

    Hi! So, I made the moving platform go up and down instead of side to side but for some reason in Roblox studio it works just fine, but when I go to test it in game the movement of the moving platform is choppy, When I try to get on the platform the part freezes for a second or two, then the player gets kicked off.
    Is there any solution to this?

    • @troxinate
      @troxinate 2 года назад +1

      This has occurred to me too, I'm not sure if there are any answers to this but hopefully The Letus Garden sees this.

    • @gavingaming854
      @gavingaming854 2 года назад +2

      How did u make it up and down

    • @yorshcyt2576
      @yorshcyt2576 Год назад +1

      When objects provide player interaction, it is best to make them functional within Local scripts.

    • @0doyer95
      @0doyer95 Год назад +1

      @@gavingaming854 I believe in the part of the script where it goes (0, 0, -20) you could make it (0, -20, 0) or something along those lines, but I am a begienner coder so don't take my word on it.

    • @audigamer8261
      @audigamer8261 Год назад

      i think its because server lag

  • @Bidombamb
    @Bidombamb 10 месяцев назад

    this works amazingly, but models don't have CFrames. so this will only work on parts alone

    • @TheLetusGarden
      @TheLetusGarden  10 месяцев назад

      Hey! For models, you can weld the model to the PrimaryPart, then apply this code to the model PrimaryPart

    • @Bidombamb
      @Bidombamb 10 месяцев назад

      @@TheLetusGarden wow, i didnt expect you to answer, but imma try that

    • @Bidombamb
      @Bidombamb 10 месяцев назад

      @@TheLetusGarden i am kinda confused on what you are trying to say

    • @TheLetusGarden
      @TheLetusGarden  10 месяцев назад

      @@Bidombamb Checkout this devforum post devforum.roblox.com/t/introduction-to-tweening-models/315253

  • @memecompilation5727
    @memecompilation5727 Год назад

    the part is tweening but the character does not follow it, the output is spammed with "attempt to perform arithmetic (sub) on Vector3 and number "
    pls help

  • @Milo_96
    @Milo_96 2 года назад +1

    How to make it slower?

  • @shai4830
    @shai4830 Год назад

    How could I do this with a part that is spinning instead of just moving

  • @yasolopro6870
    @yasolopro6870 Год назад

    it wont work and i think its cus for me the runservice is underlined red so what do i do about it?

  • @CosmicMaanz
    @CosmicMaanz 2 года назад +5

    Hey great tutorial! Do you know how I could make the part move in one direction instead of going back and forth?

    • @ddx5899
      @ddx5899 2 года назад +1

      Instead of inout you put in or out in
      Enum.EasingDirection.inout

    • @CosmicMaanz
      @CosmicMaanz 2 года назад +1

      @@ddx5899 srry I meant how do you make the part move forward forever, I tried it and it still goes back and forth

    • @Cosmetic7000
      @Cosmetic7000 2 года назад +2

      @@CosmicMaanz Set true to false in tweenInfo. The "false" means it will not repeat. The "true" means it will repeat.

  • @NotFKC_RobloxGaming
    @NotFKC_RobloxGaming Год назад

    can you do it with a button so when a player presses it then it moves up then if they press the button it gose down if they press the button on 1st floor it clls the elevator

  • @clouddog111
    @clouddog111 Год назад +1

    i've tried everything but it doesn't work T-T
    ive tried so many tutorials on this for 3 hours and none of them work, my platform just lies there
    is there something im doing wrong??

    • @frostywalker2108
      @frostywalker2108 Год назад

      probably still need help?

    • @clouddog111
      @clouddog111 Год назад

      @@frostywalker2108 yes, i hate my stupid brain ;-;

    • @frostywalker2108
      @frostywalker2108 Год назад

      @@clouddog111 I can send you the script would that help?

    • @clouddog111
      @clouddog111 Год назад

      @@frostywalker2108 OMGOMGOMG I'M SO SORRY I DIDN'T SEE IT SOONER, YES!!!! YOU'RE THE BEST

    • @davecodm1
      @davecodm1 Год назад

      @@frostywalker2108could you send it to me aswell

  • @giancarlodanielosoresquint246
    @giancarlodanielosoresquint246 7 месяцев назад

    it is not very optimal to use runservice

  • @MrSm0keee
    @MrSm0keee Год назад

    Why is everything a script can't it be easy like other editors?? 😮‍💨

  • @Ham_Burger1
    @Ham_Burger1 Год назад

    dosent work it moves the part from where it was and u cant get to it

  • @EN3RGY_ADHD
    @EN3RGY_ADHD Год назад

    thanks i did not know how to do this and i was on the urge of quitting the obby i was making

  • @riccardo9977
    @riccardo9977 Год назад

    hi, this video is really helpful. But I have a question, can it transport vehicles?

  • @CockatooTransit
    @CockatooTransit Год назад +1

    4:47 It isnt moving I copied everything

  • @csi6579
    @csi6579 6 месяцев назад

    if i wanna do a spinning plataform?

  • @alisherif2024
    @alisherif2024 2 года назад

    The negative didn't work for me it doesn't turn red how do I fix that - 10 and - 1 aren't red they are blue what am I doing wrong

  • @csi6579
    @csi6579 6 месяцев назад

    and if i wanna do a circular path?

  • @partriv
    @partriv 8 месяцев назад

    way better than asking chatgpt!

  • @badass325
    @badass325 2 года назад +2

    hi

  • @thatidiotoverthere6311
    @thatidiotoverthere6311 Год назад

    with the first half it didnt move when i clicked run

  • @iforst1639
    @iforst1639 8 месяцев назад

    This method sucks, it means you have to have a loop for every single moving parts which is super unefficient

    • @ZyanFernando
      @ZyanFernando 8 месяцев назад

      You can just create a folder and loop through all parts using for i, v in pairs

    • @iforst1639
      @iforst1639 5 месяцев назад

      It's still as inefficient.
      The best way to do this is to use a local script and raycast under the player and only do the verification on the returned instance

  • @breadisyummy_
    @breadisyummy_ Год назад

    is there a way to make it follow a set path?

  • @ZyanFernando
    @ZyanFernando 8 месяцев назад

    Note that if youre internet or device is terrible, this wont work.

  • @WindyPivot
    @WindyPivot Год назад

    great help!!

  • @calebdagoy5415
    @calebdagoy5415 Год назад

    how to make it client sided

  • @VolDen_2008
    @VolDen_2008 Год назад +1

    local TweenService = game :GetService("TweenService")
    local RunService = game :GetService("RunService")
    local part = script.Parent
    local tweenInfo = TweenInfo.new(2,Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut, -1, true)
    local tween = TweenService:Create(part, tweenInfo, {
    CFrame = part.CFrame * CFrame.new(0, 0, -10)
    })
    tween:Play()
    local lastPosition = part.Position
    RunService.Stepped:Connect(function (_, deltaTime)
    local currentPosition = part.Position
    local deltaPosition = currentPosition - lastPosition

    local velocity = deltaPosition / deltaTime
    part.AssemblyLinearVelocity = velocity
    lastPosition = currentPosition
    end)
    No problem guys!

    • @VolDen_2008
      @VolDen_2008 7 месяцев назад

      @@Franchu14 np, bro

  • @dejarisreed3572
    @dejarisreed3572 Год назад

    Does this work with unions?

  • @double_pandaa
    @double_pandaa Год назад

    how to make the platform faster?

  • @omccc
    @omccc 9 месяцев назад

    Thank you so much!

  • @gavingaming854
    @gavingaming854 2 года назад

    How to make ti move up

  • @MrAnonymouz
    @MrAnonymouz 2 года назад +2

    How do i make it move slower

    • @ToxicBeast_FF
      @ToxicBeast_FF 2 года назад

      In the 5th line just increase the number (increasing number will make it slow).

    • @BlueSquareGaming
      @BlueSquareGaming 2 года назад

      In this line:
      local tweenInfo = TweenInfo.new(2, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut, -1, true)
      change the number in TweenInfo.new(2,

  • @noskillzrequired8918
    @noskillzrequired8918 2 года назад

    Absolutely PERFECT!! tysm

  • @animatnetic2545
    @animatnetic2545 Год назад

    Absolute W, tysm

  • @SheepWizard
    @SheepWizard Год назад

    Based

  • @starterpot9029
    @starterpot9029 Год назад

    does this work with models?

  • @sandintheocean
    @sandintheocean 2 года назад +4

    What if instead you were moving a model, and wanted the player to stick onto it? How would that work?

    • @Splango
      @Splango 2 года назад

      same question. have u found a answer>?

    • @sandintheocean
      @sandintheocean 2 года назад

      @@Splango the only idea i have is putting a part under the models where the players would stand, and then use this script so players could stand on the model because of the part.

    • @unorift2865
      @unorift2865 2 года назад

      @@sandintheocean Or you know you could just get a glue part from the toolbox then glue surface on top and bottom then put the model on top of the part

    • @TheLetusGarden
      @TheLetusGarden  Год назад

      This might help! devforum.roblox.com/t/wall-stickgravity-controller/432598

  • @DenSuuOff
    @DenSuuOff Год назад

    thx !

  • @chan0kan298
    @chan0kan298 Год назад +3

    If you want to use the same method but for the orientation you have to replace "Part.Position" by "Part.Orientation" ,
    remove "deltatime" and change AssemblyLinearVelocity to AssemblyAngularVelocity

  • @julio-zb4tj
    @julio-zb4tj 2 года назад

    useful script

  • @welcomepepper
    @welcomepepper Год назад

    Very useful

  • @noobgotskill898
    @noobgotskill898 Год назад

    This was very useful!

  • @MotofoxJr
    @MotofoxJr Год назад

    does anyone know whats wrong with my code the block doesnt move
    code:
    local TweenService = game:GetService("TweenService")
    local RunService = game.GetService("RunService")
    local part = script.Parent
    local tweenInfo = TweenInfo.new(2, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut, -1, true)
    local tween = TweenService:Create(part, tweenInfo, {
    CFrame = part.CFrame * CFrame.new(0, 0, -10)
    })
    tween:Play()
    local lastPosition = part.Position
    RunService.Stepped:Connect(function (_, deltaTime)
    local currentPosition = part.Position
    local deltaPosition = currentPosition - lastPosition

    local velocity = deltaPosition / deltaTime

    part.AssemblyLinearVelocity = velocity

    lastPosition = currentPosition
    end)

  • @Cloudy_PandaPC
    @Cloudy_PandaPC Год назад

    Epic

  • @thebaconleader8776
    @thebaconleader8776 Год назад +1

    Hey, could you put the script in the desc? it would help alot and could get you more likes&views

    • @mustypickle
      @mustypickle Год назад +1

      Or just don't be lazy. If you're actually wanting to learn, copy and pasting someone else's script isn't going to help you get any better.

    • @thebaconleader8776
      @thebaconleader8776 Год назад

      @@mustypickle Im not lazy

    • @epiksis
      @epiksis Год назад +1

      @@thebaconleader8776 yep ur lazy

    • @thebaconleader8776
      @thebaconleader8776 Год назад +1

      @@epiksis ITS BECAUSE I DONT LIKE SCRIPTING AND IM NOT A SCRIPTER I BUILD MAPS.

    • @DevGabe405
      @DevGabe405 Год назад

      Lol 😝

  • @cngaming7027
    @cngaming7027 Год назад

    runservice is underlined for me! can anyone help?

  • @somebody_2837
    @somebody_2837 2 года назад +1

    Wouldn't it be better to just weld the HumanoidRootPart to the platform?

    • @memecompilation5727
      @memecompilation5727 Год назад

      nah the players character just freezes then

    • @somebody_2837
      @somebody_2837 Год назад

    • @somebody_2837
      @somebody_2837 Год назад

      ​@@memecompilation5727 No it won't, have you even tried it? If you did, you probably did it wrong by using a weld and not a weld constraint. Also, why did you bother replying to a comment posted over a year ago?

    • @memecompilation5727
      @memecompilation5727 Год назад

      @@somebody_2837 Tbh. Idk, but i needed help and i fixed it.... It was like you said and i forgot to delete the comment:)

    • @TheLetusGarden
      @TheLetusGarden  10 месяцев назад

      If you weld the root part, your character wouldnt be able to walk around the platform
      With this method, the player can still move

  • @takutokawai
    @takutokawai Год назад

    For me it only moves the part not the player.