I need help on TNT button

*local TNT = Instance.new(“Explosion”,workspace)
repeat
if script.Parent.ClickDetector.MouseClick then
TNT.BlastRadius = 10
TNT.Position = Vector3.new(219.64, -19.225, 201.65)
wait(5)
end

until true == false*

when i didnt pressed the button and when i load the game it boom already

script.Parent.ClickDetector.MouseClick:Connect(function()
   local TNT = Instance.new(“Explosion”,workspace)
   TNT.BlastRadius = 10
   TNT.Position = Vector3.new(219.64, -19.225, 201.65)
end)

How about this?

What you’re doing is if there’s event MouseClick, proceed. (I actually don’t know how this works.)
So, event is when something happened, such as MouseClick is when someone clicked ClickDetector, this event fires.

2 Likes

thats not how it works, use a function like “script.Parent.ClickDetector.MouseClick:Connect(function()”

2 Likes

oh
thank you i will try it if it work. Thank you