im trying to make it so that the enemy moves to the sound value parent's position but descendantadded is not firing...
local debounce = false
local prevpath = nil
workspace.DescendantAdded:Connect(function(sound)
-- for i,sound in pairs(workspace:GetDescendants()) do
if sound.Name == "Soundvalue" and sound:IsA("StringValue") then
print("Founded")
local hrp = script.Parent:WaitForChild("Torso")
local ischasing = script.Parent:WaitForChild("Ischasing")
if ischasing.Value == false then
if not debounce then
debounce = true
if prevpath ~= nil then
prevpath:Destroy()
end
if sound.Parent and sound.Parent:IsA("BasePart") then
print("aaaaa")
local path = game:GetService("PathfindingService"):CreatePath()
path:ComputeAsync(hrp.Position, sound.Parent.Position)
local waypoints = path:GetWaypoints()
prevpath = path
for i,waypoint in pairs(waypoints) do
if ischasing.Value == false then
script.Parent.Enemy:MoveTo(waypoint.Position)
script.Parent.Enemy.MoveToFinished:Wait()
end
end
end
debounce = false
end
end
end
--end
end)

8 comments
Did you try use 'print' to check if it actually fired?
hold on lemme try
yea i did put a little print thingy under the if statement for the soundvalues but nothing printed
It will be very funny if you add them first then change name to what you want, or I can't find why they dont find your sound
put print(sound.Name) on line 5 and test
isnt the name SoundValue not Soundvalue?
its Soundvalue
its Soundvalue