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

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

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 comment

1

Unrelated to the question, but you should put the original cup in ServerStorage

1 answer

✓ Accepted answer

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

1 comment

0

Thank you!

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