Hi! I am trying to make a give to on my cafe game. Here is my code:
local ToolNames = {"Empty Cup"}
local Storage = game:GetService("ServerStorage")
local Part = script.Parent
local ClickDetector = Part:WaitForChild("ClickDetector")
local debounce = script.Parent.Use
ClickDetector.MouseClick:connect(function(Player)
if Player and Player.Character and debounce.Value == "NotInUse" then
debounce.Value = "Inuse"
local Backpack = Player:WaitForChild("Backpack")
for i = 1, #ToolNames do
local Tool = Storage:FindFirstChild(ToolNames[i])
if Tool then
Tool:clone().Parent = Backpack
wait(3)
debounce.Value = "NotInUse"
end
end
end
end)
I’ve recreated the script and structure identical to yours, and it works just fine. Are you sure the “Empty Cup” exists directly under ServerStorage, and that the name is identical to the one in the script?