-- Update the code boolean value
while wait(1) do
local Monsters = MonstersFolder:GetChildren()
if Monsters then
CodeEnabled = false
Prompt:SetAttribute("Color", RedColor)
elseif not Monsters then
CodeEnabled = true
Prompt:SetAttribute("Color", WhiteColor)
elseif CodeHasBeenScanned == true then
CodeEnabled = false
Prompt:SetAttribute("Color", RedColor)
end
end
I made it so if there are any monsters in the monster folder, the ProximityPrompt becomes disabled. But, it turns red even if there is no monster in the folder. Help?
function ChangePrompt(Enabled, Color)
CodeEnabled = Enabled
Prompt:SetAttribute("Color", Color)
end
while true do task.wait(1)
local Monsters = MonstersFolder:GetChildren()
if #Monsters ~= 0 or CodeHasBeenScanned then
ChangePrompt(false, RedColor)
else
ChangePrompt(true, WhiteColor)
end
end
you can use # to see if a table has any values
I also added a function because of repeated code
basically your original code checked to see if Monsters was nil, a table with no values or {} isn’t nil