Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

This script to give empty cups is not working, there are no errors? [closed]

EDIT: I found out that the ClickDetector doesn't work

So I was scripting for someone, it went fine. But then I had to make this script, I see no error, there is not an error in the output either, I've rewritten the script several times, but it doesn't seem to work

Script:

local debounce = false
for _, model in pairs(script.Parent:GetChildren()) do
	if model:IsA("Model") then
		for _, part in pairs(model:GetChildren()) do
			if part:FindFirstChild("ClickDetector") then
				local storage = game:GetService("ServerStorage")
				part.ClickDetector.MouseClick:connect(function(player)
					if debounce == false and storage:FindFirstChild(part.Name) then
						debounce = true
						local clone = storage:FindFirstChild(part.Name):Clone()
						clone.Parent = player.Backpack
						wait()
						debounce = false
					end
				end)
			end
		end
	end
end

Layouts:

Script layout

Item layout

Note: not all items are shown in the item layout

2 comments

0

Which line has the error?

0

As I said, there is no error

1 answer

You named the Button where you get the Item from, as Part and Part is not in your menu :P So try to rename the Part where the ClickDetector is in to one of the Items and it should work

1 comment

0

Cause I used for _, part in pairs()

This discussion is preserved as it was. New answers, comments, and votes are closed.