Hello! I’ve never had trouble with this before, but I’m trying to clone a tool into the player’s backpack if they own a gamepass.
Here is what i have so far:
game.Players.PlayerAdded:Connect(function(player)
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, 49983842) then
local Sign = game.ReplicatedStorage:WaitForChild("Sign"):Clone()
Sign.Parent = player.Backpack
end
end)
For some reason, the tool is not in the player’s backpack/hotbar on join. But if I print the sign’s parent, it prints “Backpack”.
There is some more in the script, but I believe that is irrelevant to why this is happening.
I’ve looked through multiple sources and couldn’t find a fix. Any help is appreciated!
For all of you that come by with this same problem. The fix is after the PlayerAdded event. Add a CharacterAdded event.
For example:
Old:
game.Players.PlayerAdded:Connect(function(player)
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, 49983842) then
local Sign = game.ReplicatedStorage:WaitForChild("Sign"):Clone()
Sign.Parent = player:WaitForChild("Backpack")
end
end)
New:
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, 49983842) then
local Sign = game.ReplicatedStorage:WaitForChild("Sign"):Clone()
Sign.Parent = player:WaitForChild("Backpack")
end
end)
end)