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

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

Asked by 4 years ago
Edited 4 years ago

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.

0
Probably because there isnt a part/union/model named "Car" TotalElevation 45 — 4y
0
I want to see how to see if the car is not existing in the workspace User#29913 36 — 4y
0
If there is no object named "Car" (case and whitespace sensetive) in workspace, then that is why there is an error being thrown. IStarConquestI 414 — 4y
0
do findfirstchild on the car so that no error is being returned and then do if not car then Code1400 75 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago
if workspace:FindFirstChild("Car") == nil  then

end

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

0
i know it's named car User#29913 36 — 4y
0
Did not test it in studio so I don't know if it would work. techN0logics 40 — 4y
0
Try that script I am not telling you to name it car. techN0logics 40 — 4y
0
It's saying 'Infinite yield possible on Workspace:WaitForChild("Car")' User#29913 36 — 4y
View all comments (4 more)
0
okie User#29913 36 — 4y
0
Try it now. techN0logics 40 — 4y
0
I edited it. techN0logics 40 — 4y
0
Hey thanks! User#29913 36 — 4y
Ad

Answer this question