Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

1 comment

0

My initial question is how would I go about moving a tool from the lighting into my backpack when I enter the game

1 answer

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.

1 comment

0

I hope it helps! If so please upvote it and/or accept the anwer.

This discussion is preserved as it was. New answers, comments, and votes are closed.