How would I script a moving platform, that dose not lag players back

I am trying to make a train, that runs smoothly and just goes straight, It dose not need to go on tracks.

The problem is like a lot of moving platforms I have seen on Roblox games, When other players get on the moving part, It lags them off, but they still move with the brick.

So is there anything that could make it a better, smoother moving platform?

4 Likes

I remember roblox saying about a new part that doesn’t lag players behind but I’m not intirely sure.
If you know the player that is standing in the platform, you can CFrame the humanoidRootPart of the character with the platform but that’ll mess up the default movement.

I think to achieve this you would somehow have to change the way that roblox replicates humanoid positions so that humanoid positions are replicated relative to the platform.

I believe that this was floated as an idea for a feature by a roblox dev recently.

There was an update a while ago (around the time of RDC) that made a big update regarding what you are talking about. I’ll edit my post when I find it.

edit: Here’s the post

2 Likes

Well I was testing with what they said they added just now and I keep getting it Screenshot_53

A method I have found which might be of use. This might be what you’re looking for.

Make sure the train is unanchored and welded together and has a primary part (doesn’t actually have to be a model’s PrimaryPart, just a main part to move, preferably a platform), then insert a new part (this should be anchored, have collisions disabled and transparent, we can then use tween service on this part to move it abou, let’s call this the guide). What we will want to do is put an attachment in both the new ‘guide’ part, and the primary part of the train, then use an AlignPosition and AlignOrientation constraint with ApplyAtCentreOfMass enabled, and ReactionForceEnabled set to true. Finally make sure all parts in the train have their NetworkOwnerShip set to nil / the server.

Now when you want to move the train about, you can use TweenService to move the CFrame of the ‘guide’ part and as long as it is not too fast, then the new HumanoidPlatform feature should be working.

1 Like

I just made a train that uses no scripts, and dose not require a person to drive it, and it just uses basic roblox hinges, but right when it goes and I switch to the Server it dose this.

Try setting all the train’s parts (Provided they’re not anchored) NetworkOwner to nil (The server).

local Train = script.Parent -- Change this to the train

local function setOwnership(model, owner)
	for i,v in pairs(model:GetDescendants()) do
		if v:IsA("BasePart") and not v.Anchored then
			v:SetNetworkOwner(owner or nil)
		end
	end
end

setOwnership(Train)

Just change the Train variable, to where the Train is, or just put that code in a normal script within the train.

1 Like