Pet Follow gamepass

Hi devs , i need help with a script :

local pet = script.Parent
local MarketPlaceService = game:GetService("MarketplaceService")
local GamepassID = 156299267


function givePet (player)
	if player then
		local character = player.Character
		if character then
			local humRootPart = character.HumanoidRootPart
			local newPet = pet:Clone()
			newPet.Parent = character

			local bodyPos = Instance.new("BodyPosition", newPet)
			bodyPos.MaxForce = Vector3.new(math.huge, math.huge, math.huge)

			local bodyGyro = Instance.new("BodyGyro", newPet)
			bodyGyro.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)

			while wait() do
				bodyPos.Position = humRootPart.Position + Vector3.new(-2, 0, 0.5)--these are the numbers to edit if you want to change the position the block goes to
				bodyGyro.CFrame = humRootPart.CFrame
			end
		end
	end
end

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		if MarketPlaceService:UserOwnsGamePassAsync(player.UserId, GamepassID) then
			pet.BillboardGui.TextLabel.Text = player.Name.."'s Cat"
				givePet(player)
			
				end
			end)
		end)

Actually i want that the pet follow the player but it actually dont follow the player.

Anyone can help me?

Ok so ye nvm i just fixed it :slight_smile:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.