This is all in a normal Script, not a local script.
Screenshot 1 Screenshot 2 Screenshot 3
The helicopter is referenced using an Objectvalue, however, when attempting to reference it in the script it returns as nil, I am guessing because the server can not see it. However, I do not know any practical way around this.
local attached = script.Parent.Attached
local inlet = script.Parent.InletStatus
local main = script.Parent.MainStatus
local Return = script.Parent.ReturnStatus
local helicopter = script.Parent.helicopter.Value
function refuel()
print("refuel")
local fuel = helicopter.Parent.Parent.Stats.Fuel
while fuel.Value <100 and inlet == true and main == true and attached == true do
fuel.Value = fuel.Value + 2
wait(1 / 5)
end
end
inlet.Changed:Connect(function()
print("inlet")
refuel()
end)
main.Changed:Connect(function()
print("main")
refuel()
end)
attached.Changed:Connect(function()
print("attached")
refuel()
end)
