How To use AlignPosition in client?

In my game, I have platforms flying in the air from one position to another. I want to handle their movement on the client side to tire the server as little as possible.

When I move the platform using a Tween on the client, the character standing on it doesn’t move with the platform.

I want the platform to move smoothly and carry the character with it - all handled on the client side.

I tried using AlignPosition for platform movement, but when I change it from the client it doesn’t work as expected. I also tried setting NetworkOwner, but that doesn’t solve the problem either, as the same platform will be used by multiple players.

1 Like

movement code

for _,Track in TracksFolder:GetChildren() do
			local Attachment = Track:FindFirstChildOfClass("Attachment")

			if not AnimateRunning then break end

			if Track:IsA("BasePart") and Attachment then
				local StandValue = Track:FindFirstChild("StandbyTime")

				if StandValue ~= nil and (StandValue:IsA("IntValue") or StandValue:IsA("NumberValue")) then
					StandValue = StandValue.Value
				else
					StandValue = 0
				end

				APosition.Attachment1 = Attachment
				AOrientation.Attachment1 = Attachment

				local Mag = (Platform.Position-Track.Position).Magnitude
				
				repeat
					task.wait()
					Mag = (Platform.Position-Track.Position).Magnitude
				until Mag <= 0.5

				task.wait(StandValue)
			end
		end

If the platform is just moving from one Position to another Position in a straight line just use a PrismaticConstraint. It’s physics based so the player will just stand still on the moving platform.
This isn’t really a whole lot of load on the server. How many platforms are you using?
This is a simple Prismatic based platform tutorial model I made for someone else.
https://www.roblox.com/library/7645980152/PlatformModel

Does AlignPosition stress the server?

I don’t think it’s that bad. If you use an AlignPosition then you’ll also need an AlignOrientation so the platform doesn’t spin all over the place.

I solved this.

By cloning the moving platform from the client, placing it in the same place and deleting the previous one, I created a completely client object and thus I was able to run AlignPosition and others from the client, here is my code:

local NeedEdObjects = {"Tracks","Loop","Running","Platform","PlatormManager","Start"}

function Setup(SSChild:Folder)
	
	local Child
	
	if not SSChild:FindFirstChild("LocalObject") then
		local loaded = false
		local sTick = os.time()
		repeat
			task.wait(.5)

			local finded = 0

			for _,obj:string in NeedEdObjects do
				if SSChild:FindFirstChild(obj) then
					finded += 1
				end
			end

			if finded == #NeedEdObjects then
				loaded = true
			end
		until loaded or os.time()-sTick > 10
		
		if loaded then
			Child = SSChild:Clone()
			Child.Parent = SSChild.Parent
			SSChild:Destroy()
		end
	else
		Child = SSChild
	end
	
	if not Child then return end
	
	local LocalObject = Instance.new("BoolValue")
	LocalObject.Name = "LocalObject"
	LocalObject.Parent = Child