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