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)
#why cant my script detect the items in my backpack?
1 messages · Page 1 of 1 (latest)
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
server or local script
local
that’s why
oh
any errors? or does it just print "not working"
waittt
make it server
oh
ughhhhh but like
only way to do it
sad
wait so local and server scripts cant be compatible with eachother even tho the tools are in the persons backpack?
the tools are in the person's backpack on the client
ohhhhhhh
ok yea that makes sense
it would be very dangerous if someone could edit the game on their client and have those changes uploaded to the server
ok yea
server cant see things that happen on client
use an event
i dont know why i didnt think of it that way
how long have you been scripting for
4 months
idk why i didnt think of it that way
its okay not everyone is perfect!
so would i make seperate events for each item then have a server script check for the fired event and then give the player the item in that server script?
right?
you just need one event
o
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
i think?
can someone help me
what
i want network onwership for my game
why
make a post dont interupt my post dude
im sorry bbut ummm
ill type an example
thanks
alr ffinish with @limber herald then you can help me
make a post dude im closing this when im finsihed
😭
i already did
** You are now Level 1! **
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 😭
so the button text would be the items name?
** You are now Level 8! **
yeah
ok
yea thats what im gonna do because its imagbuttons
i think
so like it would take the item as the button text in the second part right
so like item:clone()
the item.parent = player.backpack
then*
item is the string
aka the buttonname
and you can use that to find your part
or tool
yea
so like if item.Name = a child in the folder with the tools then
blah blah blah clone script?
oh ok
item is a string
wait im slow
omg
yea
duh
sorry its like 7 am
and i havent slept yet
thanks for being patient
its okay
jesus
do you get it now
yea
did it work
yesss thankk u for your help <3