Alright, so I’m trying to create a Celeste thing in roblox, and Celeste has blocks called Traffic Light Blocks. These traffic light blocks light up, move with the player on it, then launches them off. However, I can’t get the “stand on and move with it” part to work.
This is what’s happening: https://gyazo.com/4336c974c847f45a925ea7f457f2905d
Did you try my suggestion in the post you linked? Tweened Parts aren’t moved physically, they are ‘teleported incrementally’ so that’s why players will slide off them.
If you use a PrismaticConstriaint to move the Platform the player will stay on it. You’d have to script the “then launches them off” procedure though.
I use this script sometimes created by @nooneisback
Anyways. Make a folder full of the moving parts and put the folders place in Whitelist
-- Localscript inside of StarterCharacterScripts
local Players = game:GetService("Players")
local player = game.Players.LocalPlayer
local RunService = game:GetService('RunService')
local LastHit
local LastTrainCFrame
local Function
local Function2
local Whitelist = {workspace.Trains}
Function = RunService.Heartbeat:Connect(function()
local RootPart = player.Character.HumanoidRootPart
local Ignore = player.Character
local ray = Ray.new(RootPart.CFrame.p, Vector3.new(0,-500,0))
local Hit, Position, Normal, Material
if LastHit then
Hit, Position, Normal, Material = workspace:FindPartOnRayWithWhitelist(ray,{LastHit})
if not Hit then
Hit, Position, Normal, Material = workspace:FindPartOnRayWithWhitelist(ray,Whitelist)
end
else
Hit, Position, Normal, Material = workspace:FindPartOnRayWithWhitelist(ray,Whitelist)
end
if Hit then
local Train = Hit
if not LastTrainCFrame then
LastTrainCFrame = Train.CFrame
end
local TrainCF
if Train ~= LastHit and LastHit then
TrainCF = LastHit.CFrame
else
TrainCF = Train.CFrame
end
local Rel = TrainCF * LastTrainCFrame:inverse()
LastTrainCFrame = Train.CFrame
RootPart.CFrame = Rel * RootPart.CFrame
LastHit = Train
if Train ~= LastHit then
LastTrainCFrame = Train.CFrame
end
else
LastTrainCFrame = nil
end
if not Function2 then
Function2 = player.Character.Humanoid.Died:Connect(function()
Function:Disconnect()
Function2:Disconnect()
end)
end
end)
I said in the original post that this method is buggy. This seems to work more effectively, but I’m still experiencing the same bugs. I forgot to mention in the original post, however, that the player glitches out in weird ways during testing. The result is this:
All right, I guess you should try the original solution then. I just thought the optimized one might work with the new API’s better. Then again, I didn’t really test it. Also, nice side scroller and jump effect.
I’m still experiencing the same stuff in the video I sent. I think it needs to index faster to compensate for the very fast speed of the traffic light blocks. (The speed of the traffic light blocks is 0.719 seconds, then it takes about 2.125 seconds for it to go back to original position)
Use roblox’s physics, instead of setting the CFrame constantly. It is more reliable to make the part use roblox’s physics engine instead of setting the parts CFrame.