local o local a local x local r=false script.RepairChannel.OnServerEvent:Connect(function(f,Y,l)local u=game.Players:GetPlayerFromCharacter(script.Parent.Parent)print(u,f)if u==f then x=f if Y~=nil then a=l o=a.Parent.Parent.Parent.Engine script.Internal:Fire()else r=true end end end)while true do r=false script.Internal.Event:Wait()while wait(.5)do local o=a.Parent.Parent.Parent.Engine local f=(script.Parent.Handle.Position-o.Position).Magnitude local Y=o.Velocity.Magnitude if r or f>50 or Y>3 or script.Parent.Parent:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")==nil or a.Value>=100 then script.RepairChannel:FireClient(x)a=nil break else a.Value=math.min(a.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.Players:GetPlayerFromCharacter(script.Parent.Parent)
	
	print(holder, plr)
	
	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
