#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)
what are you trying to do exactly
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
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
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
alright, i'll take a look at table.find
I managed to get it partially working but I have a Infinite Yield problem
** You are now Level 3! **
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
I solved it, even though infinite yield is still there unfortunately but I got it to work the way I wanted it to be
Maybe try repeat wait
Or just find first child when the event is called for
How does that work exactly, I’m not that much experienced and has a lot to learn about scripting