#why cant my script detect the items in my backpack?

1 messages · Page 1 of 1 (latest)

limber herald
#
local stove = script.Parent
local clickdetector = stove.ClickDetector
local replicatedstorage = game.ReplicatedStorage
local foodfolder = replicatedstorage.ChefFood

clickdetector.MouseClick:Connect(function(player)
    if player.Backpack:FindFirstChild("Cheese") then

        local CheesePizza = foodfolder:WaitForChild("CheesePizza")
        local clone = CheesePizza:Clone()
        clone.Parent = player.Backpack
    else
        print("not working")
    end
end)
#

basically ill have it so ingredents they have in their inventory they can click on the stove and if they have the certain ingredents needed it gives them another tool but for some reason it wont recognize the tools in my backpack

bleak egret
#

server or local script

limber herald
#

server

#

does it need to be local script

bleak egret
#

no

#

is the tool added through local or server script

limber herald
#

local

bleak egret
#

that’s why

limber herald
#

oh

oblique surge
#

any errors? or does it just print "not working"

limber herald
#

waittt

bleak egret
#

make it server

oblique surge
#

oh

limber herald
#

its a gui

bleak egret
#

why

#

event

limber herald
#

ughhhhh but like

bleak egret
#

only way to do it

limber herald
#

sad

limber herald
ocean walrus
limber herald
#

ok yea that makes sense

ocean walrus
#

it would be very dangerous if someone could edit the game on their client and have those changes uploaded to the server

limber herald
#

ok yea

bleak egret
limber herald
#

sorry im kinda new at this

#

yea that makes total sense

bleak egret
#

use an event

limber herald
#

i dont know why i didnt think of it that way

bleak egret
#

how long have you been scripting for

limber herald
#

idk why i didnt think of it that way

bleak egret
#

its okay not everyone is perfect!

limber herald
#

right?

bleak egret
#

you just need one event

limber herald
#

o

bleak egret
#

when you click the button send over a string with the name of the item and since itll have the player already as an arugment so you can replicate the item to them

#

if that makes sense

limber herald
#

i think?

tacit jackal
#

can someone help me

bleak egret
#

what

tacit jackal
#

i want network onwership for my game

bleak egret
#

why

limber herald
tacit jackal
#

im sorry bbut ummm

bleak egret
#

ill type an example

limber herald
tacit jackal
#

alr ffinish with @limber herald then you can help me

limber herald
#

😭

tacit jackal
#

i already did

calm forgeBOT
#

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

bleak egret
#
button.Activated:Connect(function()
    event:FireServer(button.Text)
end)

event.OnServerEvent:Connect(function(player, item)
    -- clone logic 
end)
#

yeah like thgat

#

ignore if it looks weird i just typed it in discord 😭

limber herald
calm forgeBOT
#

studio** You are now Level 8! **studio

bleak egret
#

yeah

limber herald
#

ok

bleak egret
#

i mean thats how you have it right?

#

im assuming

limber herald
#

no

#

but

#

i can do that

bleak egret
#

instead

limber herald
#

yea thats what im gonna do because its imagbuttons

bleak egret
#

yeah thatll work

#

do you understand though?

limber herald
#

i think

limber herald
#

so like item:clone()

#

the item.parent = player.backpack

#

then*

bleak egret
#

item is the string

#

aka the buttonname

#

and you can use that to find your part

#

or tool

limber herald
#

yea

#

so like if item.Name = a child in the folder with the tools then

#

blah blah blah clone script?

bleak egret
#

whats the .Name for

#

you old need findfirstchild(item)

#

only

limber herald
#

oh ok

bleak egret
#

item is a string

limber herald
#

wait im slow

#

omg

#

yea

#

duh

#

sorry its like 7 am

#

and i havent slept yet

#

thanks for being patient

bleak egret
#

its okay

limber herald
#

jesus

bleak egret
#

do you get it now

limber herald
#

yea

bleak egret
limber herald