#Detect string value not working
1 messages · Page 1 of 1 (latest)
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
yo bro use discord's codeblock thing
with the backticks n lua
i forgot how to did it
ù
its what it does
just send it to me
i can copy
then paste it three time
n stuff
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
thank you
if I may ask what's this for
fear system
npc fear u
if
the value is ur user
but it doesnt detect once an string vbalue has been added
checkced no errors
yk it detected because of prints or something in the game
yea
ok did you try changing ipairs to pairs
ima test smtg another scripter told me to then test ur idea
also I can't help but notice this isn't the entire script so I think you should send the whole thing js incase you missed something about it
the script is 190 lines so sadly i couldnt
you can send it as a file
like a .txt file
from notepad
im on mac
you don't have notepad?
lem be sure
@mellow vapor made it pairs it still doesnt work
also the other part of the script
is js path finding
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
the script being disabled is false since theres path finding and the npc seems to be walking compeltly fine
also i double checked if anything got added and it did
ok how about you send a video or something
Is this in a local script and also is the npc and folder in workspace
npc is in the workspace and the folder is inside the npc
its an script
@bleak urchin who the fuck r u