Sorry i don't know how to script a gamepass but I can give a scrip that will allow your pet to follow anyone who is in range :-
01 | local larm = script.Parent:FindFirstChild( "Left Arm" ) |
02 | local rarm = script.Parent:FindFirstChild( "Right Arm" ) |
04 | function findNearestHead(pos) |
05 | local list = game.Workspace:children() |
13 | if (temp 2. className = = "Model" ) and (temp 2 ~ = script.Parent) then |
14 | temp = temp 2 :findFirstChild( "Head" ) |
15 | human = temp 2 :findFirstChild( "Humanoid" ) |
16 | if (temp ~ = nil ) and (human ~ = nil ) and (human.Health > 0 ) then |
17 | if (temp.Position - pos).magnitude < dist then |
19 | dist = (temp.Position - pos).magnitude |
29 | local target = findNearestHead(script.Parent.Head.Position) |
31 | script.Parent.Humanoid:MoveTo(target.Position, target) |
And here is the respawn script:-
03 | robo = script.Parent:clone() |
07 | if script.Parent.Humanoid.Health< 1 then |
09 | robot.Parent = script.Parent.Parent |
11 | script.Parent:remove() |
hope it help, sorry I am new to scripting so i don't know to program a gamepass