I have been trying to make a pet that spawns when a player buys a gamepass and follows the player with the gamepass, and that specific person, so two people can have a pet at the same time if they buy the gamepass. This is what I have so far, and its not really working, nor do I know how to make it spawn and follow the person when the have the gamepass.
repeat wait()until game.Players.LocalPlayer.Character
print("Pet Controller Loaded!")
function MovePet(pet, mode)
local character = game.Players.LocalPlayer.Character
local rpet = workspace.Pet
local rmode = mode
local inc = 0.7
if mode == true then -- If this is true then make the pet float
local base = character["Head"]
else -- If its anything else other than true then make the pet go on the ground
local base = character.LeftFoot
local dir = CFrame.new(rpet.Position, base.Position).lookVector
print(dir)
for i=0,10,2 do
rpet.CFrame = rpet.CFrame + (dir * inc)
wait(0.05)
end
end
end
while wait()do
MovePet("Pet",false)
end
If anyone could tell me how to fix this, that would be great! That's if you understand what I am trying to say haha.

2 comments
I haven't really experimented with game passes, but I'm pretty sure you can check if a player has a certain gamepass. Just make a function that checks for the game pass after they buy it and then spawn the pet by cloning it from wherever you have it stored and parenting it to workspace.
Yeah, but idk how to do that.