I want to make a script that spawns in a block named Grass that is in Lighting. But if I click the button multiple times then multiple blocks will spawn, when I just want 1. Here is the script.
script.Parent.ClickDetector.MouseClick:connect(function()
local grass = game.Lighting.Grass:Clone()
grass.Parent = game.Workspace
script.Parent.BrickColor = BrickColor.new("Really black")
wait(1)
script.Parent.BrickColor = BrickColor.new("Dark green")
end)

4 comments
Officially known as a 'debounce'. http://wiki.roblox.com/index.php?title=Debounce
I can only do it once but I want to do it over and over again
That's because in TurboFusion's code he never reactivated the bool switch.
If you're only going to run a function once (when it's connected to an event), I recommend disconnecting the event instead of using a boolean value. @LordZerefu, read up on the link Goulstem provided, it gives you the code you need.