#Detect string value not working

1 messages · Page 1 of 1 (latest)

bleak urchin
#

ill send the script in the chat ill explain tho so basically it doesnt detect once an string value has been added to the folder any suggestion to fix this?

#

local function handleStringValueAdded(stringValue)
print("StringValue added: " .. stringValue.Name)

stringValue:GetPropertyChangedSignal("Value"):Connect(function()
    print("Value changed for " .. stringValue.Name .. ": " .. stringValue.Value)
    updateFearedNames()
end)

task.wait()
if stringValue.Value and stringValue.Value ~= "" then
    print("New feared name: " .. stringValue.Value)
end

updateFearedNames()

end

local fearedFolder = npc:FindFirstChild("Feared")
if not fearedFolder then
fearedFolder = Instance.new("Folder")
fearedFolder.Name = "Feared"
fearedFolder.Parent = npc
print("Created Feared folder")
end

fearedFolder.ChildAdded:Connect(function(child)
if child:IsA("StringValue") then
handleStringValueAdded(child)
end
end)

for _, child in ipairs(fearedFolder:GetChildren()) do
if child:IsA("StringValue") then
handleStringValueAdded(child)
end
end

updateFearedNames()

#

@orchid plover

#

@ivory zephyr why did u delete ur msg bra

mellow vapor
#

with the backticks n lua

bleak urchin
mellow vapor
#

the backtick character is under escape

bleak urchin
#

ù

#

its what it does

#

just send it to me

#

i can copy

#

then paste it three time

#

n stuff

mellow vapor
#
local function handleStringValueAdded(stringValue)
    print("StringValue added: " .. stringValue.Name)

    stringValue:GetPropertyChangedSignal("Value"):Connect(function()
        print("Value changed for " .. stringValue.Name .. ": " .. stringValue.Value)
        updateFearedNames()
    end)

    task.wait()
    if stringValue.Value and stringValue.Value ~= "" then
        print("New feared name: " .. stringValue.Value)
    end

    updateFearedNames()
end

local fearedFolder = npc:FindFirstChild("Feared")
if not fearedFolder then
    fearedFolder = Instance.new("Folder")
    fearedFolder.Name = "Feared"
    fearedFolder.Parent = npc
    print("Created Feared folder")
end

fearedFolder.ChildAdded:Connect(function(child)
    if child:IsA("StringValue") then
        handleStringValueAdded(child)
    end
end)

for _, child in ipairs(fearedFolder:GetChildren()) do
    if child:IsA("StringValue") then
        handleStringValueAdded(child)
    end
end

updateFearedNames()
#

here

bleak urchin
#

thank you

mellow vapor
#

if I may ask what's this for

bleak urchin
#

fear system

#

npc fear u

#

if

#

the value is ur user

#

but it doesnt detect once an string vbalue has been added

mellow vapor
#

maybe try using pairs instead of ipairs

#

also did you check for any erros in output

bleak urchin
#

checkced no errors

mellow vapor
#

yk it detected because of prints or something in the game

bleak urchin
#

it didnt detect

#

i added an print thingy

#

but

#

it doesnt print

mellow vapor
#

oo

#

so this doesn't print right:

print("StringValue added: " .. stringValue.Name)
bleak urchin
#

yea

mellow vapor
#

ok did you try changing ipairs to pairs

bleak urchin
#

ima test smtg another scripter told me to then test ur idea

mellow vapor
bleak urchin
mellow vapor
#

like a .txt file

#

from notepad

bleak urchin
#

im on mac

mellow vapor
#

you don't have notepad?

bleak urchin
#

@mellow vapor made it pairs it still doesnt work

#

also the other part of the script

#

is js path finding

mellow vapor
#

if nothing prints then there is only one explanation there's simply no children in the folder and there are no children getting added

#

or this may sound dumb but could be true you somehow have the script disabled and you didn't notice

bleak urchin
bleak urchin
mellow vapor
#

ok how about you send a video or something

bleak urchin
#

i forgot whats that

#

im jk

#

i cant

onyx glade
#

Is this in a local script and also is the npc and folder in workspace

bleak urchin
#

its an script

orchid plover
#

@bleak urchin who the fuck r u