My cup giver script is supposed to give players a tool called Cup when a button is clicked. The cup is in serverstorage. I see absolutely no reason why the script shouldn't work, but it doesn't. Why?

local ToolName = ("Cup")
local Storage = game:GetService("ServerStorage")
local Part = script.Parent
local clickdetector = Part:WaitForChild("ClickDetector")
clickdetector.MouseClick:connect(function(Player)
	if Player and Player.Character then 
		local backpack = Player:FindFirstChild("Backpack")
		for i = 1, #ToolName do
			local Tool = Storage:FindFirstChild(ToolName[i])
		if Tool then
			Tool:clone().Parent = backpack
		end
		end
		end
end)

3 comments

0

is your game FE?

0

put it in replicated storage and edit the script for that?

0

How about putting the Cup in Lighting?