#This isn't working and i don't know why

1 messages · Page 1 of 1 (latest)

eager heart
#

HELP ME

pseudo kindle
eager heart
#

they are a bool value

pseudo kindle
eager heart
#

oh thanks

#

im dumb

#

thats so simple man how did i not noticed

pseudo kindle
wintry bay
#

holy nested if statements

eager heart
#

it didnt work

#

i modified a little and still didnt work

#

is suppose to be working

pseudo kindle
eager heart
#

server

floral mauve
# eager heart

Put them all in a table and make a for loop instead all of these if statements 😭

eager heart
#

srry i didnt understand it

#

im a newbie

pseudo kindle
floral mauve
eager heart
#

oh

#

thats make sense now

pseudo kindle
# eager heart yes

Lets see if the Triggered event is running by adding a print("hello world") and see if you can find it in the output

floral mauve
eager heart
floral mauve
#
local allclicked = true
for I,v in pairs(table) do
if v.Value  then allclicked= true
else allclicked = false return end 
end```
Double check for mistypos
pseudo kindle
eager heart
#

for all of them

floral mauve
eager heart
#

like that?

wintry krakenBOT
#

studio** You are now Level 5! **studio

floral mauve
#

It loops thro every clicked variable and if one of them is not true then it'll set allclicked to false and not continue the for loop

eager heart
#

ok thanks

#

i will try it

#

play to see if works

floral mauve
eager heart
#

oh thats why it didnt work

floral mauve
#

Also place the table and the allclicked boolean outside of the while loop

eager heart
#

thanks for all the help

floral mauve
# eager heart thanks for all the help
local Collisions = script.Parent.Collisions

local GreenPart = script.Parent.GreenButton
local Prompt = GreenPart.ProximityPrompt

local stickmasterluke = script.Parent.Stickmasterluke
local sticknoid = stickmasterluke.Sticknoif

local AllClicked = false
task.Spawn(function()
while task.wait() do
for I,v in pairs(clickables) do
If v.Value == true then AllClicked = true 
else AllClicked =false break end
end
end)
prompt.Triggered:Connect(function()
if AllClicked then
sticknoid:TakeDamage(100)
end
end)```
#

Double check misstypos too sense all of this code is from memory

eager heart
#

the ```lua
task.Spawn

floral mauve
floral mauve
#

Instead of the entire spawned function

#

Less lag, only fires when a then value is changed instead of every ms

shut quarry
#

thats pretty bad, I think the objective of the one who created the post is do a thing when all are clicked right? @eager heart