Nothing seems to work, this is the code used: (Just seeing if I copied all correctly)
If there’s any more information needed besides this local script do tell me because I’ll gladly share them!
local player = game.Players.LocalPlayer
local character = player.Character
local ownsGamepass = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,8530571)
game.Players.LocalPlayer.CharacterAdded:Connect(function(char)
if ownsGamepass then
repeat wait() until game:GetService("ReplicatedStorage"):FindFirstChild("Pet")
local pet = game:GetService("ReplicatedStorage"):FindFirstChild("Pet")
pet.Parent = char
end
end)
Try debugging, tell me if you what you see in the console if you put this code in:
local player = game.Players.LocalPlayer
local character = player.Character
local ownsGamepass = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,8530571)
game.Players.LocalPlayer.CharacterAdded:Connect(function(char)
if ownsGamepass then
print("THEY OWN THE PASS!")
else
print("WHERE IS THE PASS?!")
end
end)
Okay good! We found out it might not the be the inside code.
So now try doing this:
local player = game.Players.LocalPlayer
local character = player.Character
local ownsGamepass = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,8530571)
if ownsGamepass then
print("THEY OWN THE PASS!")
else
print("WHERE IS THE PASS?!")
end
local player = game.Players.LocalPlayer
local character = player.Character
while true do
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,8530571) then
local pet = game:GetService("ReplicatedStorage"):FindFirstChild("Pet")
pet.Parent = character
end
wait()
end
It must be a mistake on my end considering nothing happens at all. These are the only objects located inside the game. (There is only one LocalScript if I get rid of the old one, LocalScript2 that is.
Okay so, since remember it said you didn’t own the gamepass, actually buy it.
Also here is the same script but gives you the pass when you don’t own the gamepass just for testing:
local MPS = game:GetService("MarketPlaceService")
local pet = game:GetService("ReplicatedStorage"):FindFirstChild("Pet")
local GamePassID = 8530571
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function( character )
if MPS:UserOwnsGamePassAsync(player.UserId, GamePassID) then
pet:Clone().Parent = character
print("Pet given")
else
pet:Clone().Parent = character
print("Pet given")
print("You didn't own the pass but I still gave you the pet!")
end
end)
end)
This actually worked, I did own the gamepass already. But I received the pet straight away after spawning in. I will also try this without owning the gamepass beforehand.
EDIT: So when I own the gamepass already and then join the game it gives me the pet, but it doesn’t give me the pet straight away without rejoining.
Just don’t forget to remove the part where it gives the player the pet when they don’t own the gamepass.
That part was for testing if it would say in the console you don’t own it.
local player = game.Players.LocalPlayer
local character = player.Character
local HasPass = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,8530571)
local function check ()
if HasPass then
local pet = game:GetService("ReplicatedStorage"):FindFirstChild("Pet")
pet.Parent = character
end
end
player.CharacterAdded:connect:(check)
HasPass:GetPropertyChangedSignal():connect(check)
I have joined the game owning, and not owing the gamepass. It only gives me the pet when I actually own the gamepass so that shouldn’t be an issue. Unfortunately the player does have to rejoin in order for them to receive their pet but I’m guessing that’s not too big of a problem as I can just mention it.