local Y local b local e local s=false script.RepairChannel.OnServerEvent:Connect(function(C,V,j)local h=(game:GetService("\080\108\097\121\101\114\115")):GetPlayerFromCharacter(script.Parent.Parent)if h==C then e=C if V~=nil then b=j Y=b.Parent.Parent.Parent.Engine script.Internal:Fire()else s=true end end end)while true do s=false script.Internal.Event:Wait()while wait(.5)do local Y=b.Parent.Parent.Parent.Engine local C=(script.Parent.Handle.Position-Y.Position).Magnitude local V=Y.Velocity.Magnitude if s or C>50 or V>3 or script.Parent.Parent:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")==nil or b.Value>=100 then script.RepairChannel:FireClient(e)b=nil break else b.Value=math.min(b.Value+1,100)end end end


local repairTarget
local repairingValue

local apparentHolder

local requestStop = false


script.RepairChannel.OnServerEvent:Connect(function(plr, engine, valObj)
	local holder = game:GetService("Players") :GetPlayerFromCharacter(script.Parent.Parent)

	if holder == plr then
		apparentHolder = plr

		if engine ~= nil then
			repairingValue = valObj
			repairTarget = repairingValue.Parent.Parent.Parent.Engine

			script.Internal:Fire()
		else
			requestStop = true
		end
	end
end)

while true do
	requestStop = false
	script.Internal.Event:Wait()

	while wait(.5) do
		local engine = repairingValue.Parent.Parent.Parent.Engine
		local dist = (script.Parent.Handle.Position - engine.Position).Magnitude
		local vel = engine.Velocity.Magnitude

		if requestStop or dist > 50 or vel > 3 or script.Parent.Parent:FindFirstChildOfClass("Humanoid") == nil or repairingValue.Value >= 100 then
			script.RepairChannel:FireClient(apparentHolder)

			repairingValue = nil
			break
		else
			repairingValue.Value = math.min(repairingValue.Value + 1, 100)
		end
	end
end
