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

Why does this not give me a cup?

Asked by 8 years ago

So when you click a part Inside the model 'Cup' (which is inside the model, Medium) its supposed to give you a cup, but for some reason its not

for i, part in pairs(workspace.Medium.Cup:GetChildren()) do
    print("cup loaded")
    if part:IsA("Part") then
        mouse.Button1Down:connect(function()
            print("click")
            local targ = mouse.Target
            if targ == part then
                print("target")
                game.Lighting.Medium.Cup:Clone().Parent = plr.Backpack
                print("gave")
            end
        end)
    end
end

EDIT: it doesnt print anything

FULL:


plr = game.Players.LocalPlayer mouse = plr:GetMouse() for i, model in pairs(workspace.Pizza:GetChildren()) do mouse.Button1Down:connect(function() local targ = mouse.Target if targ == model then game.Lighting.Pizza:Clone().Parent = plr.Backpack end end) end for i, model in pairs(workspace.Sandwiches:GetChildren()) do mouse.Button1Down:connect(function() local targ = mouse.Target if targ == model then game.Lighting.Sandwich:Clone().Parent = plr.Backpack end end) end for i, part in pairs(workspace.Small.Cup:GetChildren()) do mouse.Button1Down:connect(function() local targ = mouse.Target if targ == part then game.Lighting.Small.Cup:Clone().Parent = plr.Backpack end end) end for i, part in pairs(workspace.Medium.Cup:GetChildren()) do print("cup loaded") if part:IsA("Part") then mouse.Button1Down:connect(function() print("click") local targ = mouse.Target if targ == part then print("target") game.Lighting.Medium.Cup:Clone().Parent = plr.Backpack print("gave") end end) end end for i, part in pairs(workspace.Large.Cup:GetChildren()) do mouse.Button1Down:connect(function() local targ = mouse.Target if targ == part then game.Lighting.Large.Cup:Clone().Parent = plr.Backpack end end) end
0
Does output give any errors? ISellCows 2 — 8y
0
nope bubbaman73 143 — 8y
0
Can you add your full script? ISellCows 2 — 8y
0
Is the script under ServerStorage, Lighting, or disabled? M39a9am3R 3210 — 8y
View all comments (6 more)
0
Its a localscipt in a players starterscripts, and ill add the full thing bubbaman73 143 — 8y
0
Try putting it in StarterPack or StarterGui. ISellCows 2 — 8y
0
Didnt work bubbaman73 143 — 8y
0
btw its just the cups for some reason bubbaman73 143 — 8y
0
I tried it in studio, it worked for me. Do you got a picture of the explorer(Not sure what it's called, the directory their all in.)? ISellCows 2 — 8y
0
well i fixed the 'Form' directory but still nothing, https://gyazo.com/5b9a401546ef50a5dda071f3bd2000df bubbaman73 143 — 8y

Answer this question