Moving Platform with Physics Constraints thumbnail
0 views0 copies0 likes

Moving Platform with Physics Constraints

Universal script

Copy it, then test it in your own Studio place.

Utilities Verified

Script code

26 lines · 1.0 KB
Download
local RunService = game:GetService("RunService")local part = workspace:WaitForChild("ShuttlePlatform")part.Anchored = falsepart:SetNetworkOwner(nil)local origin = part.Positionlocal frame = part.CFrame.Rotationlocal attachment = Instance.new("Attachment", part)local align = Instance.new("AlignPosition")align.Mode = Enum.PositionAlignmentMode.OneAttachmentalign.Attachment0 = attachmentalign.Position = originalign.MaxForce = math.hugealign.Responsiveness = 45align.Parent = part-- …open Get script for the full source

About this script

Make an unanchored Part named ShuttlePlatform and place it over a flat test area. This server script uses AlignPosition and AlignOrientation to shuttle the platform smoothly between its original position and a point 24 studs away. It keeps authority on the server and uses a smooth target curve. Test with your intended rider weight and tune the force and settling time for larger platforms.

Comments

Share what works, ask questions, or report an issue.

0

Log in to leave a comment.

No comments yet

Be the first to share your thoughts!

Raw Luau source

local RunService = game:GetService("RunService")
local part = workspace:WaitForChild("ShuttlePlatform")
part.Anchored = false
part:SetNetworkOwner(nil)
local origin = part.Position
local frame = part.CFrame.Rotation
local attachment = Instance.new("Attachment", part)
local align = Instance.new("AlignPosition")
align.Mode = Enum.PositionAlignmentMode.OneAttachment
align.Attachment0 = attachment
align.Position = origin
align.MaxForce = math.huge
align.Responsiveness = 45
align.Parent = part
local orientation = Instance.new("AlignOrientation")
orientation.Mode = Enum.OrientationAlignmentMode.OneAttachment
orientation.Attachment0 = attachment
orientation.CFrame = frame
orientation.MaxTorque = math.huge
orientation.Responsiveness = 45
orientation.Parent = part
local began = workspace:GetServerTimeNow()
RunService.Heartbeat:Connect(function()
	local cycle = (1 - math.cos((workspace:GetServerTimeNow() - began) * math.pi / 4)) / 2
	align.Position = origin + Vector3.new(24 * cycle, 0, 0)
end)