#The script is not working and i don't know why
1 messages · Page 1 of 1 (latest)
pairs works for either, but only ipairs would work for arrays
Though it's no longer needed
In that while loop, you're connecting to every clickable's Changed event over and over and over. That's bad.
So like it's not doing anything at all? Is the Triggered event firing?
what a minute
like
i recoded it
and now is just one button
i really would like it to be 4 buttons
one button works?
yeah
Issue is you have a for loop with no wait
is not hard do that
so it check all at once if v.Value = true
you only clicked one probably
so all 3 others are false
which returns false break end
well yea
it didnt crash
you don't have any task.wait inside for loop
i dont want to do this wait thing, i want something more optimized like check if the player pressed one of the buttons
one of the buttons or all
yeah
just check when all buttons are pressed or when a button is pressed
i need this finished until tomorrow
this is a easter quest im making
what is the Bool variable
is a boolvalue
when the player press the button it becomes true
like Click.MouseClick:Connect(function() BoolValue.Value = true
basically you want something to happen if all 4 buttons are clicked
ok
have a while not AllClicked do
inside it make a for loop
with your clickables array
Output
Send the output
Debug with print
im trying to recode it
i will do it after the recode
im trying to do somenthing with "for i, v do"
i did this but it activates everytime when i click one of them like not everybody
** You are now Level 6! **
sure
local clickables = script:GetChildren() -- an array of BoolValue's
local function checkAll()
for _, v in clickables do
if v:IsA("BoolValue") and not v.Value then
return false
end
end
return true
end
--TEST!!!
while task.wait(3) do
if checkAll() then
print("all are true")
end
end
issue is youre infinitely looping the check
** You are now Level 3! **
your*
this is just for testing
local clickables = {boolvalues here}
local prompt = Instance.new("ProximityPrompt")
local function checkAll()
for _, v in clickables do
if v:IsA("BoolValue") and not v.Value then
return false
end
end
return true
end
prompt.Triggered:Connect(function()
if checkAll() then
print("all are true")
end
end)
'you're' was right (randomly popping in)
the problem was solved