So I keep getting the error
''Workspace.MovingSharks.Script:9: bad argument #2 to '?' (string expected, got Object)"
I've tried and tried again but to avail, What's wrong?
local movingpeices = script.Parent.MoveToPieces:GetChildren()
local sharks =script.Parent:GetChildren()
while wait() do
wait(1)
for i,v in pairs (sharks) do
if script.Parent.Shark.Name == "Shark" then
local target = movingpeices[math.random(1, #movingpeices)]
local path = game:GetService("PathfindingService"):ComputeRawPathAsync(script.Parent.Shark.Torso.Position, target.Position, 500)
local points = path:GetPointCoordinates()
if path.Status == Enum.PathStatus.Success or Enum.PathStatus.ClosestNoPath then
repeat wait() until points ~= nil
for i = 1, #points do
script.Parent.Shark.Humanoid:MoveTo(points[i])
end
end
end
end
end

3 comments
Nevermind, the script box had cut off half of the line, heh.
lol
v.Name, you are searching for an object through the square brackets, you need to search the object's name. Also, you might end up grabbing the script in the "local sharks" variable.