Trying to make a GUI detect if a certain brick is missing but I have no idea on how do I make a script check if a certain brick is not there.
Example:
if -- command that checks if it is not there with a certain name then script.Parent.Frame.Visible = false
New to vehicle /gun scripting.
Use the FindFirstChild
method to return the object if it exists.
if not workspace.Model:FindFirstChild("PartName") then script.Parent.Frame.Visible = false end
Make a variable using FindFirstChild.
For example:
Part = Part'sParent:FindFirstChild("PartName")
Then, do an if/then
statement, to see if it exists:
if Part == nil then script.Parent.Frame.Visible = false
Add them all together, and you get this:
Part = Part'sParent:FindFirstChild("PartNameHere") if Part == nil then script.Parent.Frame.Visible = false
NOTE: Replace (Part'sParent) with the location of the part's parent, and replace "PartNameHere with the name of the part you want to check that exists or not
Please accept my answer if this helped!
You need to write something like this:
local PlayerGui = game.Players.LocalPlayer:WaitForChild('PlayerGui') local Thing = game.Workspace:FindFirstChild('[ Part Name ]') if Thing == nil then PlayerGui.[ Gui ].Frame.Visible = false end
Just like that.