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)