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

How can I make the script target all the things it clones into workspace ?

function onClicked(playerWhoClicked)
	game.ServerStorage.Car:Clone  .Parent = Workspace
	game.Workspace.Car:MakeJoints()
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)

Whenever I click the button the 1st time it works, but whenever I click it again it doesn't work. I realized the problem was when I click it again, there are already to cars in workspace and we cant clone all of them how do I fix this ?

1 answer

✓ Accepted answer

#What you could do Make the cloned car a variable so you can easily track it again.


#Final Product

function onClicked(playerWhoClicked)
    local car = game.ServerStorage.Car:Clone()
    car .Parent = Workspace
    car:MakeJoints()
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)


Hope it helps!

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