Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
Valatos 166
7 years ago
Edited 7 years ago

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

0
Which line has the error? TheLuckyZ 24 — 7y
0
As I said, there is no error Valatos 166 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

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

0
Cause I used for _, part in pairs() Valatos 166 — 7y
Ad

Answer this question