#For loop

54 messages · Page 1 of 1 (latest)

whole zenith
#

Hi, It's warning twice the proximity prompt "a" only, not warning "b". How can I fix that?

local function proximities()
    for i, v in game:WaitForChild("Workspace"):WaitForChild("Fries"):GetDescendants() do
        if v:IsA("ProximityPrompt") then 
            task.wait()
            warn(v.Name)
            return v
        end
    end
end

proximities()
#

Output: ```lua
a (x2)

whole zenith
#

Not

#

But I think it's relateed to that much I sent

restive ibex
#

youre returning v

#

remove return

#

or return outside of loop

#

and why are you waiting for workspace

mental stone
#
local Fries = game.Workspace:WaitForChild("Fries")
for _, prox in ipairs(Fries:GetDescendants()) do
  if prox:IsA("ProximityPrompt") then
    warn(prox.Name)
  end
end
whole zenith
restive ibex
#

game.Workspace 💔

#

ipairs 💔

mental stone
restive ibex
#

just do workspace.stuff

restive ibex
mental stone
restive ibex
#

its deprecated

mental stone
#

same output

#

idgaf

restive ibex
#

skid behaviour

whole zenith
karmic swallow
whole zenith
#

I want proximities() = a and b

karmic swallow
#

Ah fuck it, typecast everything to make sure the proximity prompts have the correct type

spare lindenBOT
#

studio** You are now Level 8! **studio

karmic swallow
whole zenith
#

There is some instances that not proximity, but I just want them

sand seal
#

I think Workspace is deprecated but game.Workspace being deprecated doesn't make sense.

karmic swallow
karmic swallow
sand seal
restive ibex
sand seal
sand seal
karmic swallow
restive ibex
#

yeah surely its not a better coding ethic

sand seal
#

Idek what you mean by "better coding ethic" you mean a good programming practice?

karmic swallow
#

There is no real reason to do game.workspace anymore. I do even believe it's less efficient than just indexing the global

sand seal
karmic swallow
#

(And even if it isn't, fuck talking about the 4 lines in a script that actually use the global)

sand seal
karmic swallow
mental stone
#

Idfk what he wants either so

#

@whole zenith

#

read