How would I go about making a Wallstick without the custom "gravity"

Hey everyone!

I am attempting to create a “Platform Lock” system for my future games. My goal is to be able to keep a player walking around and jumping while on a platform that moves via TweenService.
This system will be used for:

  • Trains with multiple carriages (Similar to Jailbreak)
  • Elevators
  • Other moving objects

I currently have two issues. The first is not as important as the second since I am prioritizing

So far I have looked through 3 solutions

  1. I tried using the method in the solution of this post, It worked for everything other than the issues stated this is also my current method.

  2. I tried using EgoMooses WallStick modules, even though it works remarkably, it has too many features I do not want. I attempted to make a simpler version that only applies to the floor similar to the previous approach however I am not that advanced at scripting and had no clue what to do

  3. I have looked through a few other posts on dev forum, but none of them were specific enough to my requirements

function onHeartBeat(): ()
	if HumanoidRoot:IsDescendantOf(game) then
		local Result: RaycastResult = workspace:Spherecast(HumanoidRoot.Position, 1, DOWN_VECTOR, PlatformRayParams)

		if Result and Result.Instance and Result.Instance:IsA("BasePart") and Humanoid.Sit == false then
			local Instance_Current: BasePart = Result.Instance
			local CFrame_Current: CFrame = Instance_Current.CFrame

			if ClientStorage.CFrame_Previous == nil or ClientStorage.Instance_Previous ~= Result.Instance then
				ClientStorage.CFrame_Previous = CFrame_Current
			end

			local Rel: CFrame = CFrame_Current * (ClientStorage.CFrame_Previous :: CFrame):Inverse()

			ClientStorage.Instance_Previous = Result.Instance
			ClientStorage.CFrame_Previous = CFrame_Current
			HumanoidRoot.CFrame = Rel * HumanoidRoot.CFrame
		else 
			ClientStorage.Instance_Previous = nil
			ClientStorage.CFrame_Previous = nil
		end
	end
end

Any help is much appreciated, If there is a way to improve my current script to meet my requirements that would be great!

Best, BusinessX

2 Likes

Hi, have you found a solution? I have the same problem at the moment and can only jump between platforms when my train speed is slow.

EDIT: By the way I found this a few days ago and it may be a better method

Thank you so much for providing this information, I had no idea this existed.

Normally the solution to these is to move everything but the train, and this is likely the only way you can realistically keep multiple players in-sync.

The alternative is quite complicated but the only other way I can think of is creating a “dummy” character, assigning control to the dummy, and then making a copy of the physical parts/colliders and replicating those relative CFrames back to the moving variant. You could maybe make each client responsible for the position of the non-dummy character to replicate properly but it’s a lot of work when you don’t need it