So I have VIP scripts that give you an item and it puts it's supposed to put it in the startergear. For some reason, it only puts it in the player's backpack, and after he dies, it disappears. And even stranger, this only happens in online mode.
I also checked in game using :GetChildren in the console, and that didn't show the items.
I found a temporary solution, and that is putting The startergear line (13) before the backpack line (14). But instead, the item wasn't placed in the players backback.
What is the cause of this problem? I think it's naming "plr" in line 10, so the order of code seems to matter. Any help would be helpful.
This is the code:
local passId = 430308264
local potato = game.Lighting:WaitForChild("Jetpack")
function isAuthenticated(player)
return game:GetService("MarketplaceService"):PlayerOwnsAsset(player, passId)
end
game.Players.PlayerAdded:connect(function(plr) -- player is already defined
if isAuthenticated(plr) then
print(plr.Name .. " HAS BOUGHT A JETPACK!")
potato:Clone().Parent = plr.Backpack
potato:Clone().Parent = plr.StarterGear
end
end)
