i have a part that in my local script, it exists but when referenced later it throws error not valid member of
local car = script:WaitForChild("Car").Value
for i,v in pairs(car:GetChildren()) do
repeat wait() until v
end
local stats = car:WaitForChild("Configurations")
local Raycast = require(car.CarScript.RaycastModule)
local rayDistance = car.RayDistance
local BaseSpeed = car.Parent.Stats.BaseSpeed.Value
local hit, position, normal
local chassis = car:WaitForChild("Chassis")
while game:GetService("RunService").Heartbeat:Wait() do
-ERROR-
hit, position, normal = Raycast.new(car.Chassis.Position, car.Chassis.Position.CFrame:vectorToWorldSpace(Vector3.new(0, -3.5, 0)))
-ERROR-
end
the while loops runs which implies that the line in which the chassis wait to appear, it runs and chassis does exist but when later referenced it throws the error, it seems to bug for me idk whatelse do
EXTRA: while writing this, i found that if i do
local chassis = car:WaitForChild("Chassis")
hit, position, normal = Raycast.new(chassis.Position, chassis.Position.CFrame:vectorToWorldSpace(Vector3.new(0, -3.5, 0)))
it works but i dont think i can do this with all child car