Hi, I have a problem on my game, basically what I am trying to do is make a pet follow it's owner, I tried this script, but it gives me the error in the title.

Fixed Script inside of the pet(not a local script)

local Animal = script.Parent
local Owner = Animal.Owner
local Workspace = workspace
while true do
 if Owner.Value ~= "." then
  print(Owner.Value.."'s the owner of",Animal.Name)
  local Torso = Workspace:FindFirstChild(Owner.Value).Torso
  print(Torso.Parent)
  Animal.Position = Torso.Position + Vector3.new(5,0,5)
  print("And it should follow "..Owner.Value)
 end
wait()
end

The problem here is, that the script says the my character is not a child of Workspace. :C

4 comments

0

Try to use local Workspace = workspace ; I think game.Workspace is deprecated

0

Still.

0

Never mind, I fixed it.

1

game.Workspace is not decaperated that is the datamodel, Workspace is decaperated alone