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)
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!
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😅
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)
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.
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
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?
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()
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()
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)
its not working for me
@@FOXeliterblx try use same names of blocks
what if i wanted to make another platform move? like let's say Platform2? how would i modify this?
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!
Tysm! I looked at a bunch of other tutorials on moving platforms but none of them worked. But this one worked!
Great tutorial on moving platforms, thanks for sharing!
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!
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😅
Thank you!! Great tutorial, very helpful
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
idk why but it dosent even move for me?
I love how you up so frequently
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)
Unfortunately, BodyVelocity was removed, meaning this is probably the only way to make moving platforms for obbies.
I did everything step by step, and it doesn’t work, could something have changed and depend on the version of roblox
I refine shall refine this!
can you make a tutorial on how to animate swords?, like how you did with guns
is there a way to make the player move along with a part thats animated?
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.
can you make one showcasing it working for multiple people? or will it already work for multiple people
I subbed
dosent make my character move with it bro
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
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?
It didn't work with me
How to moving platform 💀
BRO THANK YOUU I LOVE U!!!!!!! LIKE AND SUB FRL
1000 errors for me?!
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()
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()
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