Moving A Player With A Platform?

Greetings all,

I’ll try to keep this simple and short but give you the context you’ll need to understand my question. I am making a game where obstacles are procedurally generated and you’re on a conveyor belt headed to a fire pit, but I noticed something. Once you make it to the end of the course it pretty much comes down to you waiting for the obstacles to be generated for you to complete and gets boring fast. The reason you ask? It’s simple; your character is not moving with the platforms, meaning that there is no risk of falling behind or death. Your character is stationary while the whole map moves and this shouldn’t be the case.

According to many users on discord, a feature called Humanoid Platforms (Platform Relative Character Replication) is already out and turned on by default. This was rolled out in 2018 and to my knowledge, is still in the engine today. But why is this not working in my case?

Attached below is a video of an early prototype and you can see the problem here. I’ll also attach my code below so you can see how I have these plates moving. Let me know if you have a solution to this!

Thanks!


Attachments:

Video:
robloxapp-20200622-1428328.wmv (1.8 MB)

Code:

-->: Services
local scriptService = game:GetService("ServerScriptService")

-->: Variables
local obstacle = script.Parent
local obstacleLead = script.Parent.PrimaryPart
local obstacleProperties = require(scriptService.MainOperatingScripts.ObstacleManagement.ObstacleProperties)
local obstacleSpeed = obstacleProperties.obstacleSpeed
local obstacleFrequency = obstacleProperties.obstacleFrequency
local obstacleDecay = obstacleProperties.obstacleDecay
local decayState = 0

-->: Runs
while wait(obstacleFrequency) do
	if decayState == obstacleDecay then
		obstacle:Destroy()
		break
	end
	obstacle:SetPrimaryPartCFrame(obstacle.PrimaryPart.CFrame + Vector3.new(0,0,obstacleSpeed))
	decayState = decayState + 1
end

Module:

local module = {}

module.obstacleSpeed = 0.2 -- In Studs
module.obstacleFrequency = 0.001-- In Seconds
module.obstacleDecay = 600 -- In Frequency Ticks

return module

I will as well try to understand what you have meant

Also, pro tip: https://devforum.roblox.com/t/stop-using-gyazo/179679, Please do not use Roblox's screen recorder for recording videos.

As long as you’re trying. :stuck_out_tongue:
Is there something you don’t understand about it? I thought I did an okay job of explaining.

If the character is NOT moving with the platforms, how is there NO risks of falling behind or death?

So there may not be no risks of death but there is certainly no risk of falling behind as the player doesn’t move even though there is a moving platform under them, so you’re either going to die from a missed jump or something rather than that fire pit at the opposite end of where the obstacles are spawning.

Either way, it’s besides the point. I just want to figure out how to get my player to move with the platform under him rather than him not moving at all from being on the platform.

The humanoid platform feature is only for physics-based platforms if I recall, so you’d have to either stop using CFrames and switch to body movers/constraints, OR detect which players are standing on the platform and move their HumanoidRootPart with the platform manually using code.

I think I’ll be forced to use the HumanoidRootPart route. Do you have any resources that could help me with that, because I don’t even know where to begin.

Actually, I just remembered another way you can do it, but it might not keep the player’s momentum in midair. If the platform is anchored, you can probably just edit its Velocity too, so that it’ll drag the players along with it. But if you need the player to keep moving with the platform even in midair, or just think CFraming would work better, I would probably use Zone+ to detect players and move their root accordingly. I haven’t actually done this myself, but I think it should be easy enough to figure out.

Looks great, I’ll look into it!

1 Like