Flash light won't appear in hot bar when picked up

Hi all
I am making a horror game and i have made flash light which can be picked up by making it parent the starter pack.

but it is going to the starter pack when clicked but dose not appear below?
Here is the script

local FlashLight = script.Parent
local click = script.Parent.ClickDetector

script.Parent.Handle.LightR.Enabled = false
script.Parent.p.Light.Enabled = false
script.Parent.Beam2.light.Brightness = 0

local function Pickup(Player)
	FlashLight.Parent = game.StarterPack
	script.Parent.Handle.LightR.Enabled = true
	script.Parent.p.Light.Enabled = true
	script.Parent.Beam2.light.Brightness = 1
end

click.MouseClick:Connect(Pickup)

parent it to the player’s backpack.

if you want to know why, contents from StarterPack are cloned into the player’s backpack when they spawn, so you should navigate to the player’s backpack if you want to manipulate anything in there.

i think the player’s backpack is the starterpack

nope. it’s the same thing with StarterGui and PlayerGui.

just change this to

FlashLight.Parent = Player["Name"].Backpack

ok so i am new to roblox studio so how do i define a player when there is no player in game.players

this takes in the Player object as the only argument. therefore, you already have the player.

1 Like