#Need help on how to make a list of names for a certain script to search that matches with the list

1 messages · Page 1 of 1 (latest)

olive stream
#


function GloveNames.Test1()
    print("Test1")
end

GloveNames.Test2 = function()
    print("Test2")
end

GloveNames.GloveVariable = "Killstreak" or "Killstreak2"

return GloveNames```

I am trying to create a list and I can't figure out how
#

the script codes you are seeing are being in modulescript

next dagger
#

what are you trying to do exactly

olive stream
#

I am trying to have a script that connect to [Glove: N/A] to search with any name in the list found on modulescript, and I can't seems to figure it out because an array is in the way

next dagger
#

why tho

#

what's this for?

#

and why does it need to be an array?

olive stream
#

my game will have multiple gloves with different names, and It needs to find an exact name of a glove that I equipped and if it did then the Glove Power can be updated

next dagger
#

why not do this in the glove?

#

glove.name=the_name updateglovepower(glove)? or something like that?

#

if you wanted to lookup in a table that's just as easy gloves={glove1=true; glove2=true} print(gloves["glove1"]) -- true

#

or if you want to keep it an array you can use table.find

#

lots of options

olive stream
#

alright, i'll take a look at table.find

olive stream
#

I managed to get it partially working but I have a Infinite Yield problem

hardy heartBOT
#

studio** You are now Level 3! **studio

olive stream
# heady swan Show me habibi
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
local GloveStatsNum = Player.GloveStatsDetect
local GloveV = GloveStatsNum.Value
local GloveModuleN = require(game.ReplicatedStorage.GloveNames)
local GloveTool = Humanoid.Parent:WaitForChild(GloveModuleN[GloveV]).Hitbox.HitHandler

local textIndicator = script.Parent


local function UpdatePower()
    textIndicator.Text = GloveTool.Power.Value
    
end

UpdatePower()


Humanoid.Parent:WaitForChild(GloveModuleN[GloveV]).Hitbox.HitHandler.Power:GetPropertyChangedSignal("Value"):Connect(UpdatePower)```
#

WaitForChild is what causing the infinite yield

#

if I don't swap glove, it will work fine. However upon switching to a different glove will just cause a infinite yield, and I tried to figure out to work it around

olive stream
#

I solved it, even though infinite yield is still there unfortunately but I got it to work the way I wanted it to be

heady swan
#

Or just find first child when the event is called for

olive stream