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

Cup dispenser script won't work. The tool won't be cloned. Could someone help me?

Asked by 4 years ago
script.Parent.ClickDetector.MouseClick:Connect(function(player)
    local cup = game.Lighting.Cup
    cup:Clone()
    cup.Parent = player.Backpack
end)

What I've tried to create here is a cup dispenser. After clicking the cup, a tool version of the cup from game.Lighting should clone and become a child of my backpack, but it won't be cloned, so it won't work after I've clicked it once. Have I done this incorrectly? Is it too simple?

1
Unrelated to the question, but you should put the original cup in ServerStorage ReidTheHuman 1 — 4y

1 answer

Log in to vote
0
Answered by
sheepposu 561 Moderation Voter
4 years ago

It should be this

script.Parent.ClickDetector.MouseClick:Connect(function(player)
    local cup = game.Lighting.Cup:Clone()
    cup.Parent = player.Backpack
end)

Before you were setting the parent of the original because you didn't save the clone in a variable

0
Thank you! Andreaaaaxo 6 — 4y
Ad

Answer this question