I’ve been trying to create a moving platform that the player also moves along side with. From looking at the dev forum I found this old open source place that has a moving platform using a prismatic force.
https://www.roblox.com/games/2506819790/Platformer-movement
I want the platform to wait a couple of seconds before it moves. I’ve tried many different options such as setting the velocity to 0 for a bit or anchoring the platform for a bit and while these do stop the platform from moving, the player stops moving along side the platform.
Here’s the original code:
local SPEED = 10;
local start = script.Parent:WaitForChild("Start");
local finish = script.Parent:WaitForChild("Finish");
local attach0 = Instance.new("Attachment");
attach0.CFrame = CFrame.new();
attach0.Parent = script.Parent;
local attach1 = Instance.new("Attachment");
attach1.CFrame = finish.CFrame;
attach1.Parent = game.Workspace.Terrain;
local pris = Instance.new("PrismaticConstraint");
pris.ActuatorType = Enum.ActuatorType.Motor;
pris.MotorMaxForce = math.huge;
pris.Attachment0 = attach1;
pris.Attachment1 = attach0;
pris.Parent = script.Parent;
local forward = true;
pris.Velocity = SPEED;
attach1.CFrame = finish.CFrame
start.Touched:Connect(function(hit)
if (hit == script.Parent and not forward) then
forward = true;
pris.Velocity = SPEED;
attach1.CFrame = finish.CFrame
end
end)
finish.Touched:Connect(function(hit)
if (hit == script.Parent and forward) then
forward = false;
pris.Velocity = -SPEED;
attach1.CFrame = start.CFrame
end
end)
I’ve tried to look through the dev forum but most of the solutions have the actuator type set to servo and use target destination where as I want to uses parts as a way point system in the future.