Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Drain is not a valid member of the script?

Asked by
u_g 90
8 years ago

I've been making a script, where a fuel tank will drain when hit by a certain projectile. However, one of the errors I've encountered is "Drain is not a valid member of the script", even though it is a valid member of the script. I've tried findFirstChild and WaitForChild, but neither work. Please help.

local flightsettings = plane.Seat.Main.FlightSettings
local newscript = script:findFirstChild("Drain"):clone()
newscript.Parent = flightsettings:WaitForChild("FuelLitres")
newscript.Disabled.Value = false
newscript.InfDrain.Value = true
newscript.MaxInstance.Value = newscript.Parent.Parent:WaitForChild("MaxFuelLitres")
newscript.Draining.Value = true
newscript.LitresPerSecond.Value = 0.5

(And, yes, plane is defined earlier.)

Answer this question