So I need to see if true gets detected and it does.
But when I check for false it does not. I tried if not elseif else, I tried everything.
--
local function CheckForLazer()
for i,v in pairs(Lazer:GetChildren()) do
if v:IsA("Part") then
IsLazerBought.Changed:Connect(function(bought)
if bought == true then
v.Transparency = 0
IsLazerActive.Changed:Connect(function(active)
if active == true then
print(active)
elseif not active then
print("not active")
end
end)
end
end)
end
end
end
CheckForLazer()
local function CheckForLazer()
for i,v in pairs(Lazer:GetChildren()) do
if v:IsA("Part") then
IsLazerBought.Changed:Connect(function(bought)
if bought == true then
v.Transparency = 0
end
end)
IsLazerActive.Changed:Connect(function(active)
if active then
print(active)
else
print("not active")
end
end)
end
end
end
CheckForLazer()
--
local function CheckForLazer()
for i,v in pairs(Lazer:GetChildren()) do
if v:IsA("Part") then
IsLazerBought.Changed:Connect(function(bought)
if bought == true then
v.Transparency = 0
IsLazerActive.Changed:Connect(function(active)
if active == true then
print(active)
elseif active == false then
print("not active")
end
end)
end
end)
end
end
end
CheckForLazer()
hello, no it doesn’t work, coz I put boolean value, and it checks bool, like inside game, without it, it doesn’t works, I also been a dummy and deleted my old save file, now all I have to do is reconstruct it a bit.
local bool = Model:Waitforchild(“BoolValue”, 20)
if not bool then return end
This will make the script wait for the bool to exist for 20 seconds
I’m assume the code is in a function which relies on the bool, so it’s safe to terminate the function completely if for some reason the bool is gone.
However, the reason why your bool is disappearing is a separate issue to your original question. If the bool is supposed to always be in the same location WaitForChild is the appropriate method. If there are multiple instance that may or may not contain a bool of a particular name, you’ll need to check first if the bool exists, and if not you could use Instance.new to make one.
I would prefer you open a new topic for this, but if you want it fixed in this thread, post the script and explain your issue.