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

When Player Enters a game change the parent of a tool to the players backpack?

Asked by 9 years ago
local GlobalVariable = ("VincentBarzini") -- This is my UserName aka Global Variable called later on
local function OwnerEntered() -- Function to start when I enter the server
    a = game.Players:GetPlayers("VincentBarzini") -- get players whose name is VincentBarzini
    if a == true --[[If this is totally equal to Vincent Barzini then Add the tool "Lucky" to the parent of global variable's Startergear aka VincentBarzini]]
        then game.Lighting.Lucky.Parent = game.Players.GlobalVariable.StarterGear
    end
end
0
My initial question is how would I go about moving a tool from the lighting into my backpack when I enter the game VincentBarzini 5 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

The problem is here:

game.Players.GlobalVariable.StarterGear

because you when you type this, it is searching for something named "GlobalVariable" in game.Players. To fix it, just replace that with this:

game.Players:FindFIrstChild(GlobalVariable).Backpack

Another error that is fixed in this: StarterGear does not exist within a player, the player tool storage is called Backpack. StarterGear is used to set starter gear, as the name implies. Also, the ('s in local GlobalVariable = ("VincentBarzini") aren't necessary.

0
I hope it helps! If so please upvote it and/or accept the anwer. dudemanloserr 15 — 9y
Ad

Answer this question