Heres what i want to know how do i make a script on a button like when i click it will do the events then i want to click the button again to revert the events
This is the simplest thing I could think of. Just change the script around to do what you want it to do, these are just the basics of doing and undoing with one button. If you need further help just ask, I'll reply asap.
script:
local Button = script.Parent
local status = 0 --1 = on (item spawned) , 0 = off (item is not spawned)
function spawnobject()
if status == 0 then wait(1) status = 1 local ball = Instance.new("Part") ball.Parent = game.Workspace ball.Position = Button.Position ball.Shape = "Ball" ball.Size = Vector3.new(5,5,5) ball.Name = "SpawnedBall" end
end
Button.ClickDetector.MouseClick:connect(spawnobject)
function despawnobject()
if status == 1 then wait(1) status = 0 game.Workspace:FindFirstChild("SpawnedBall"):Destroy() end
end
Button.ClickDetector.MouseClick:connect(despawnobject)
Closed as Not Constructive by OldPalHappy
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?