local j=script:WaitForChild("\099\114\101\097\116\101\084\119\101\101\110\073\110\100\105\099\097\116\111\114")function j.OnServerInvoke(j,Z,h)local n=nil if not Z:findFirstChild("\116\119\101\101\110\067\111\100\101")then n=Instance.new("\073\110\116\086\097\108\117\101")n.Name="\116\119\101\101\110\067\111\100\101"n.Value=h n.Parent=Z else n=Z.tweenCode n.Value=h end return n end local Z=script:WaitForChild("\108\101\114\112\067\070")function Z.OnServerInvoke(j,Z,h,n,W,S)spawn(function()Z[h]=n:lerp(W,S)end)end local h=script:WaitForChild("\100\101\108\101\116\101\084\119\101\101\110\073\110\100\105\099\097\116\111\114")function h.OnServerInvoke(j,Z,h)if Z.Value==h then Z:Destroy()end end
----------------------------------------------------------------------
--------------------[ TWEENJOINT HANDLING ]---------------------------
----------------------------------------------------------------------

local createTweenIndicator = script:WaitForChild("createTweenIndicator")
function createTweenIndicator.OnServerInvoke(_, Joint, newCode)
	local tweenIndicator = nil
	if not Joint:findFirstChild("tweenCode") then --If the joint isn't being tweened, then
		tweenIndicator = Instance.new("IntValue")
		tweenIndicator.Name = "tweenCode"
		tweenIndicator.Value = newCode
		tweenIndicator.Parent = Joint
	else
		tweenIndicator = Joint.tweenCode
		tweenIndicator.Value = newCode --If the joint is already being tweened, this will change the code, and the tween loop will stop
	end
	return tweenIndicator
end

local lerpCF = script:WaitForChild("lerpCF")
function lerpCF.OnServerInvoke(_, Joint, Prop, startCF, endCF, Alpha)
	spawn(function()
		Joint[Prop] = startCF:lerp(endCF, Alpha)
	end)
end

local deleteTweenIndicator = script:WaitForChild("deleteTweenIndicator")
function deleteTweenIndicator.OnServerInvoke(_, tweenIndicator, newCode)
	if tweenIndicator.Value == newCode then --If this tween functions was the last one called on a joint then it will remove the code
		tweenIndicator:Destroy()
	end
end
