i’m making a basic anticheat (please dont say if its bad or not, thats not what im here for),
but when i check if a screengui is inside of startergui, so by looking on the devforum i found that i should use FindFirstChild,
so i did and there was nothing in output saying that a error has occured, but the thing is, the print() doesn’t fire, which is bad
my script:
local startergui = game:GetService("StarterGui")
while true do
wait(0.1)
screengui = startergui.ScriptExecuter
end
while true do
wait(0.1)
if startergui:FindFirstChild("ScriptExecuter") then
print("screengui!!! exists!!!")
end
if screengui.Enabled == false then
screengui.Enabled = true
end
end
my script is located in ServerScriptService
and theres nothing in output, just some warnings that has absolutely nothing to do with this situation
Why are you putting a loop for setting screengui to startergui.ScriptEdtior? This loop’s is preventing you from continuing through the rest of the script, since loops yield a script unless it’s been broken out of, or condition isn’t true (if you didn’t know that already). I believe the rest of the script would be fine, though.
If, for some reason, you wanna keep them in a loop, then you should look up how to use coroutines, or task.spawn.
ohhhh thanks! I forgot to remove some old code which caused it to break.
now that I removed the unneccessary loop it works as intended.
local startergui = game:GetService("StarterGui")
local screengui = startergui.ScriptExecuter
while true do
wait(0.1)
if startergui:FindFirstChild("ScriptExecuter") then
print("screengui!!! exists!!!")
end
if screengui.Enabled == false then
screengui.Enabled = true
end
end