How To MAKE a Moving Platform in Roblox!

Поделиться
HTML-код
  • Опубликовано: 18 окт 2024

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

  • @rustysillyband
    @rustysillyband  5 месяцев назад +7

    Since this code is complicated, I will post it here incase you run into an error. However, this is not an excuse to just copy the code. Please follow the tutorial and learn from it. Thanks!
    Code:
    --{{ SERVICES }}--
    local Players = game:GetService("Players")
    local RunService = game:GetService("RunService")
    --{{ VARIABLES }}--
    local player = Players.LocalPlayer
    local character = player.Character or player.CharacterAdded:Wait()
    local Function
    local lastPlatformCFrame
    --{{ FUNCTIONS }}--
    local function onCharacterDied()
    Function:Disconnect()
    end
    local function onHeartbeat()
    local rootPart = character:WaitForChild("HumanoidRootPart")
    local raycastParams = RaycastParams.new()
    raycastParams.FilterDescendantsInstances = {character}
    raycastParams.FilterType = Enum.RaycastFilterType.Exclude
    local raycastResult = workspace:Raycast(rootPart.Position, Vector3.new(0, -50, 0), raycastParams)
    if raycastResult and raycastResult.Instance.Name == "Platform" then
    local platformCFrame = raycastResult.Instance.CFrame
    if lastPlatformCFrame then
    local rel = platformCFrame * lastPlatformCFrame:inverse()
    rootPart.CFrame = rel * rootPart.CFrame
    end
    lastPlatformCFrame = platformCFrame
    else
    lastPlatformCFrame = nil
    end
    end
    character:FindFirstChild("Humanoid").Died:Connect(onCharacterDied)
    Function = RunService.Heartbeat:Connect(onHeartbeat)

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

      its not working for me

    • @ABCDtf2
      @ABCDtf2 2 месяца назад

      @@FOXeliterblx try use same names of blocks

    • @naiistired
      @naiistired 2 месяца назад

      what if i wanted to make another platform move? like let's say Platform2? how would i modify this?

  • @urnix69
    @urnix69 Месяц назад +2

    Hands down, this is the best moving platform tutorial.
    Many other moving platform tutorials will use AlignPosition and use unanchored parts, which caused a variety of problems (such as multiple players being able to weigh down the moving platform, causing it to break), as well as the platform randomly taking a long time before it decides to move again.
    I'm glad you were able to help, and this video was the exact starting point of how I learnt Raycasting, which has helped me fixing a variety of issues on my game.
    Thank you so much for everything!

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

    Tysm! I looked at a bunch of other tutorials on moving platforms but none of them worked. But this one worked!

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

    Great tutorial on moving platforms, thanks for sharing!

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

    Thanks so much man, the structure of your code helped me to resolve an error I was trying to fix for 2 months. Keep it up!

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

    Rusty, i wanna say thanks to you for the tycoon series, am so excited when will my tycoon game get completed. Everything worked, i added walls,more powerful dropper and many other things.idk why many people get unwanted errors but mine was perfect, animation worked, bugs got fixed.. the only mistake i made was, i forgot to update the tycoon in server storage, which made me confusing😅

  • @WesKingVideos
    @WesKingVideos 2 месяца назад

    Thank you!! Great tutorial, very helpful

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

    I knew a plugin called something like “scene builder” it could make a lot of types of different effects on parts like levitating or kill part

  • @MrChicken-db1ms
    @MrChicken-db1ms 3 месяца назад +4

    idk why but it dosent even move for me?

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

    I love how you up so frequently

  • @lakentrkfudge
    @lakentrkfudge 2 месяца назад

    I’m curious as to why you didn’t just use BodyVelocity or constraint movers like VectorForce or LinearVelocity. At that point, scripting wouldn’t be necessary since platforms that move using constraint movers already move the player along it (unless you wanted the platform to move forward and back like in the video)

  • @morc_o
    @morc_o 2 месяца назад +1

    Unfortunately, BodyVelocity was removed, meaning this is probably the only way to make moving platforms for obbies.

  • @ivanshalygin3693
    @ivanshalygin3693 2 месяца назад +1

    I did everything step by step, and it doesn’t work, could something have changed and depend on the version of roblox

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

    I refine shall refine this!

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

    can you make a tutorial on how to animate swords?, like how you did with guns

  • @kpeti1418
    @kpeti1418 2 месяца назад

    is there a way to make the player move along with a part thats animated?

  • @DragonDeen253
    @DragonDeen253 2 месяца назад

    this is an awesome video its really helpful but i see a few other people having the same issue as me of typing it perfectly and it still not working do you have any ideas to a common mistake we might be making I've tried several times and even copied your code comment but still nothing,
    thank you.

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

    can you make one showcasing it working for multiple people? or will it already work for multiple people

  • @LyricChimera684
    @LyricChimera684 2 месяца назад

    I subbed

  • @ZacYS_
    @ZacYS_ 8 дней назад

    dosent make my character move with it bro

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

    Nice video but since the code was not working, I quite literally copied your code into my own. I fixed all the errors that were put into you copying the code into the comments, and it still didn't work. What the flip

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

    can you test my games?
    user:Testingacc691
    games:Slime attack!!! , Persent obby etc
    and also can you recreate the tycoon series because it didnt work.Can you just put the scripts in the description?

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

    It didn't work with me

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

    How to moving platform 💀

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

    BRO THANK YOUU I LOVE U!!!!!!! LIKE AND SUB FRL

  • @-stars.and.raindrops-
    @-stars.and.raindrops- 2 месяца назад

    1000 errors for me?!

  • @codernikkolas-sy5hm
    @codernikkolas-sy5hm 5 месяцев назад +2

    Good Video rusty, I have a similar movement part
    local TweenService = game:GetService("TweenService")
    local part = script.Parent
    local info = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, -1, true)
    local newPosition = part.Position + Vector3.new(0, 10, 0)
    local tween = TweenService:Create(part, info, {Position = newPosition})
    tween:Play()

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

    Hey great video the local script works but for some reason the tween script isn't working for me or i typed it wrong even tho reckecked it numerous times so i used this tween script then it works:
    local TweenService = game:GetService("TweenService")
    local Info = TweenInfo.new(
    5,
    Enum.EasingStyle.Linear,
    Enum.EasingDirection.Out,
    math.huge,
    true,
    0
    )
    local Goals =
    {
    CFrame = game.Workspace.Endpoint.CFrame
    }
    local Move = TweenService:Create(script.Parent, Info, Goals)
    wait(1)
    Move:Play()

  • @ВадимГеннадійович-т4к
    @ВадимГеннадійович-т4к 5 месяцев назад

    Cool tutorial, but realy complicate code. Typed it by myself two times and it wasn`t worked . Then I cipied your code in comment and it start working