Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

Items not being placed in StarterGear? (Unanswered)

Asked by 8 years ago
Edited 8 years ago

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)

1 answer

Log in to vote
0
Answered by 8 years ago

How about just putting it in StarterGear. When you put it in StarterGear, you have to reset for it to work. Or you cna change the .PlayerAdded to LocalPlayer and change the script into a LocalScript..?

Ad

Answer this question