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