There's 2 ways to not let that script run again.
The first method would be to completely destroy the part, and it's children, from the game.
The second method would be to disable the script, if you still want the part to be there.
First Method: Destroy
To do this, you would wait until the part was touched by a person, and then destroy it after you turn off the lights. This will completely remove the part from the game.
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local Block = game.Workspace.Flickeringlightbulb.SmoothBlockModel
Block.PointLight.Enabled = true
wait(3)
Block.PointLight.Enabled = false
script.Parent:Destroy()
end
end)
Second Method: Disable
To do this, you would wait until the part was touched by a person, and then disable the script so it doesn't run again. It will keep the part in the game.
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local Block = game.Workspace.Flickeringlightbulb.SmoothBlockModel
Block.PointLight.Enabled = true
wait(3)
Block.PointLight.Enabled = false
script.Disabled = true
end
end)
Hope this helped! If this worked, let me know by selecting this as the answer!
3 comments
What are trying to do exactly? Do you want it to never be able to happen again, or do you want a cooldown?
never to happen again
There's 2 ways, you can either destroy the part, completely remove it from the game, after they touch it, or disable the script if you want the part still there, after they touch it.