The script says it all i just want to click and it makes explosions where the mouse is
local player = game.Players.LocalPlayer local mouse = player:GetMouse() mouse.Button1Down:connect(function() local e = Instance.new("Explosion") e.Parent = game.Workspace e.BlastPressure = 10 -- Edit this according to your needs. e.BlastRadius = 10 -- Edit this according to your needs, as well. e.Position = mouse.hit -- This will place the explosion at your mouse. end)
There's probably a much better way to do this but what I've done here is created an invisible part at your mouse, and simply set the explosions position to the part.
local player = game.Players.LocalPlayer local mouse = player:GetMouse() mouse.Button1Down:connect(function() local m = Instance.new("Part") m.Anchored = true m.CanCollide = false m.Transparency = 1 m.Size = Vector3.new (1,1,1) m.Parent = game.Workspace m.CFrame = mouse.hit wait() local e = Instance.new("Explosion") e.BlastPressure = 10 e.BlastRadius = 10 e.Position = m.Position e.Parent = game.Workspace m:Destroy() end)
I Tested it in studio and it worked. Let me know if it helped!
The reason it doesn't work is that you're setting the parent to workspace before you're setting the other properties. As soon as an explosion exists in workspace, it explodes. Set the parent last.