How to prevent a HingeConstraint from being locally stimulated

I’m making a chairlift model in which I have a part that is tweened throughout a set of points and I have another part (A) in which is welded to the anchored part that is tweened. Part A also has an attachment that attaches another part (B) in which the bottom portion of the lift is welded to. The problem is that the bottom portion of the lift is locally stimulated because according to Roblox Documentation…

I’m not sure why the code would be relevant but I’ve provided it below just in case.

Code
-- [[Services]] --
local TweenService = game:GetService("TweenService")

-- [[Variables]] --
local Chair = script.Parent
local Chairlift = script.Parent.Parent

local LastUsedPoint

-- [[Functions]] --
local function findNextPoint()
	local distanceToBeat = nil
	local closest
	
	for _, Point in pairs(Chairlift.TweeningPoints:GetChildren()) do
		if (Chair.PrimaryPart.CFrame.LookVector:Dot(Point.Position - Chair.PrimaryPart.Position) < 0) then
			if LastUsedPoint == nil or Point.Name ~= LastUsedPoint.Name then
				if Chair.PrimaryPart.CFrame.LookVector:Dot(Point.CFrame.LookVector) >= 0.9 then
					if distanceToBeat == nil then
						if (Vector3.new(0, 0, Chair.PrimaryPart.Position.Z) - Vector3.new(0, 0, Point.Position.Z)).Magnitude > 0 then
							distanceToBeat = (Vector3.new(0, 0, Chair.PrimaryPart.Position.Z) - Vector3.new(0, 0, Point.Position.Z)).Magnitude
							closest = Point
						end
					else
						if (Vector3.new(0, 0, Chair.PrimaryPart.Position.Z) - Vector3.new(0, 0, Point.Position.Z)).Magnitude > 0 then
							if (Vector3.new(0, 0, Chair.PrimaryPart.Position.Z) - Vector3.new(0, 0, Point.Position.Z)).Magnitude < distanceToBeat then
								distanceToBeat = (Vector3.new(0, 0, Chair.PrimaryPart.Position.Z) - Vector3.new(0, 0, Point.Position.Z)).Magnitude
								closest = Point
							end
						end
					end
				end
			end
		end
	end
	
	LastUsedPoint = closest
	
	return({closest, distanceToBeat})
end

local function tweenThroughoutLift()
	while true do
		local NearestPoint = findNextPoint()
		local CurrentTween
		local Speed
		
		local inStation = false
		
		if NearestPoint[1]:FindFirstChild("Turn") then
			Speed = Chairlift.Values.TurnSpeed.Value
			
			if Chairlift.TweeningPoints:FindFirstChild(tonumber(LastUsedPoint.Name + 1)) then
				NearestPoint = {Chairlift.TweeningPoints:FindFirstChild(tonumber(LastUsedPoint.Name + 1))}
			else
				NearestPoint = {Chairlift.TweeningPoints:FindFirstChild("1")}
			end
			
			inStation = true
		elseif NearestPoint[1]:FindFirstChild("Station") then
			Speed = NearestPoint[2] / NearestPoint[1]:FindFirstChild("Station").Value
			
			inStation = true
		else
			Speed = NearestPoint[2] / Chairlift.Values.RopeSpeed.Value
			
			inStation = false
		end
		
		if inStation then
			Chair.Chair.HingePart.HingeConstraint.LimitsEnabled = true
			Chair.Chair.HingePart.HingeConstraint.LowerAngle = 0
			Chair.Chair.HingePart.HingeConstraint.UpperAngle = 0
		else
			Chair.Chair.HingePart.HingeConstraint.LimitsEnabled = false
		end

		CurrentTween = TweenService:Create(
			Chair.PrimaryPart,
			TweenInfo.new(Speed, Enum.EasingStyle.Linear),
			{CFrame = NearestPoint[1].CFrame}
		)

		CurrentTween:Play()
		CurrentTween.Completed:Wait()
	end
end

-- [[Events]] --
wait(3)
spawn(tweenThroughoutLift)

Server Sided Results: lift - Roblox Studio 2024-01-24 20-30-00
Client Sided Results: lift - Roblox Studio 2024-01-24 20-30-39

Is there anyway I can make the bottom portion replicate to the server so it’s not choppy as shown within the client sided result?

Thanks!

1 Like