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

How do i make the script detect if something exists???

So I wanted to make some sort of script that detects if a gui exist or not but I don't know what I should do. can someone help?

if script.Addon == true then
script.Addon.Parent = game.StarterGui
else
script.Parent:Destroy()
end

1 answer

✓ Accepted answer

use :FindFirstChild("ITEM NAME") here is a wiki page of FindFirstChild: Wiki - FindFirstChild

Here is your Fixed Script.

if script:FindFirstChild("Addon") then
	script.Addon.Parent = game.StarterGui -- This not send for all players, you need to send to PlayerGui.
else
	script.Parent:Destroy()
	wait(3) -- For no errors on remove the item.
end

Hope it helped :D

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