Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

why is "car" not a valid member of workspace?

Ok, so I was making an error frame in ScreenGui number 1 in case that the car = nil and the localscript in ScreenGui number 2. Here is the code:

if not workspace.Car then
if game:GetService("UserInputService").TouchEnabled then
script.Parent.Parent.Parent.screen.Frame:TweenPosition(UDim2.new(0.216, 0,0.162, 0))
elseif game:GetService("UserInputService").KeyboardEnabled then
script.Parent.Parent.Parent.screen.Frame:TweenPosition(UDim2.new(0.344, 0,0.3, 0))
end
end

For some reason the output is Car is not a valid member of Workspace . Any help will be appreciated, thank you.

4 comments

0

Probably because there isnt a part/union/model named "Car"

0

I want to see how to see if the car is not existing in the workspace

0

If there is no object named "Car" (case and whitespace sensetive) in workspace, then that is why there is an error being thrown.

0

do findfirstchild on the car so that no error is being returned and then do if not car then

1 answer

✓ Accepted answer
if workspace:FindFirstChild("Car") == nil  then

end

Try that and make sure the part or model or whatever is named Car.

8 comments

0

i know it's named car

0

Did not test it in studio so I don't know if it would work.

0

Try that script I am not telling you to name it car.

0

It's saying 'Infinite yield possible on Workspace:WaitForChild("Car")'

0

okie

0

Try it now.

0

I edited it.

0

Hey thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.