#Can't parent a tool to the players backpack

1 messages · Page 1 of 1 (latest)

distant tulip
#

I am not really sure why this happens. I think it makes sense, but it just doesn't work. I tried the local player. It parents with everything else fine except the backpack. This is probably super simple, and I am just overthinking it, but I can't figure it out.

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local StarterGui = game:GetService("StarterGui")



local plr = Players.LocalPlayer
local PlayerGui = plr:WaitForChild("PlayerGui")
local GameGui = PlayerGui:WaitForChild("GameGui")
local Frame = GameGui.Frame
print(Frame)
local Silly = Frame.Silly
print(Silly)
local leaderstats = plr:WaitForChild("leaderstats")

local Clicker = ReplicatedStorage:WaitForChild("Clicker")

local statsModule = require(game.ReplicatedStorage.modules.leaderstats)

local function clickMoney()
    local money = leaderstats:WaitForChild("Money")
    local sillyClone = Silly:Clone()
    sillyClone.Parent = Frame
    print(sillyClone)
    --[[local random1 = math.random(1, 99)
    local random2 = math.random(1, 99)
    print(random1)
    print(random2)
    local pos1 = UDim2.new(random1, random2)
    local pos2 = UDim2.new(random2, random1)]]
    sillyClone.Position = UDim2.new(0.276, 0, 0.433, 0)
    sillyClone.Visible = true
    money.Value += 1
    print("money")
    task.wait(1)
    --sillyClone:Destroy()
    
end

local function giveClicker(player)
    local clickerClone = Clicker:Clone()
    local Backpack = player:WaitForChild("Backpack")
    print(Backpack)
    clickerClone.Parent = Backpack
end

Players.PlayerAdded:Connect(function(player)
    giveClicker(player)
end)

print("guh")```
fallen blazeBOT
#

studio** You are now Level 1! **studio

amber monolith
#

Is that a localscript or script

distant tulip
bitter narwhal
#

ik everyone ask stupid ahh questions like im about to but are you parenting a tool?

distant tulip
#

Yeah

#

its a tool

amber monolith
#

Players PlayerAdded only words on a script

bitter narwhal
#

oh ok

amber monolith
#

Works*

bitter narwhal
#

you can do like

amber monolith
#

You are using Players.LocalPlayer which is a local and Players.PlayerAdded is a server

bitter narwhal
#

local player = game.Player.LocalPlayer
local Char = player.Character or player.CharacterAdded:Wait()

amber monolith
#

Also it might fail if you parent a tool in a localscript

distant tulip
#

Ive put it in a server script but it also doesnt work

bitter narwhal
#

if you want to parent stuff to the players backpack do it on the server on the client it wont really work right

distant tulip
#

Its originally in replicated storage, then I try to clone it and parent it into the backpack

bitter narwhal
#

go to workspace properties i might be way off but there is a thing i forgot the name let me look

#

idk if thats the issue but in the past ive tried to do stuff like parent or move things and its just gone its not even where it should be like it does not exist in the game disabling this will fix that but might cause lag on a full game so if it does not fix it then turn it back on

distant tulip
#

It didn't, I really don't know why it won't parent

bitter narwhal
#

any errors or warnings from the script?

distant tulip
#

No, it just doesnt parent

#

it just ceases to exist

bitter narwhal
#

if not add print statment at the end of each function see if they function is running fully if it does not print anything on a function then thats your problem

distant tulip
#

It can parent to the player fine

#

but when I do the backpack it just stops working

#

My codes seems fine

    local clickerClone = Clicker:Clone()
    local Backpack = player:WaitForChild("Backpack")
    print(Backpack)
    print(Backpack)
    clickerClone.Parent = player
end

Players.PlayerAdded:Connect(function(player)
    giveClicker(player)
end)```
bitter narwhal
#

im lowk ngl confused on what you mean so your just trying to parent the tool to players backpack?

fallen blazeBOT
#

studio** You are now Level 2! **studio

amber monolith
#

Try print backpack parent

distant tulip
#

yeah

bitter narwhal
#

in here abve then end in the function do Print("Worked") or something

amber monolith
#

Does backpack.Parent print your name

bitter narwhal
#

see if the print runs

distant tulip
distant tulip
amber monolith
distant tulip
#

Not sure why though

amber monolith
#

Change to player.backpack

distant tulip
fallen blazeBOT
#

studio** You are now Level 2! **studio

bitter narwhal
distant tulip
#

the tool gests vaporised

amber monolith
#

clickerClone.Parent = player in ur script

bitter narwhal
#

move the print up each line until it priints once it does the line of code under is your problem

distant tulip
#

and it did

amber monolith
#

But not clone to backpack?

distant tulip
#

yeah

amber monolith
#

clickerClone is a tool right?

distant tulip
#

yeah

bitter narwhal
#

move this out of the function at the top of your script

#

like move it to the top

#

could be its not getting the backpack in time

distant tulip
#

Turns out I needed to wait till the character was loaded in first

#

Thanks for the help

wind atlas