Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

How to make so if a object is clicked it gets deleted after 5 seconds?

Asked by 5 years ago
Edited 5 years ago

can someone help me with a script that deletes a object after 5 seconds if its clicked.

0
This is not a request site. Your question's description should almost never start with "I need." BlueGrovyle 278 — 5y
0
Ok thanks BlueGrovyle for the info. johnoscarbhv1 137 — 5y

2 answers

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

Okay you clearly know nothing about ROBLOX Lua, and didn't attempt to solve this yourself.

BUT HEY I feel nice today.

script.Parent.MouseMouseButton1Click:Connect(function()
wait(5)
YourObjectNameHere:Destroy()
end

put this script inside the object you want to destroy() clickdetector

0
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa Mirzadaswag 110 — 5y
Ad
Log in to vote
2
Answered by 5 years ago

You Can use ClickDetectors for that. Right Click the Object you want to be deleted within 5 seconds (in the Explorer) Hover your mouse to [Insert Object] Insert an [ClickDetector] into the Object

Now insert a Script into the Object Write this Code on the Script:

local Object = script.Parent
local ClickDetector = Object:WaitForChild('ClickDetector')
ClickDetector.MouseClick:Connect(function(Player) --You won't use "Player", its optional.
    ClickDetector:Destroy() --Removes the ClickDetector, so it can't be clicked Again
    wait(5) --How Many Seconds before the Object gets Removed?
    Object:Destroy() --Remove the Object
end)

Instead of CTRL+C and CTRL+V, Study how the Code works and experiment it!

0
You realize he cant "study" this right? he clearly knows nothing about lua, or even tried to learn anything. He just wants to leach, he knows nothing at all, take code and not learn. He wont understand any of this JuuzouBlitz 75 — 5y
0
i'm not going to start a discussion because of an Coding Answer, i understand what you mean but i hope he can learn something even if a bit. FullMetalEdward45221 106 — 5y
0
I actually study it to lern I'm a newbeginner johnoscarbhv1 137 — 5y
0
Sorry i was rude i wasn't thinking, and thats good, Good luck man JuuzouBlitz 75 — 5y

Answer this question