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

MouseTarget problem?

Asked by 8 years ago

I was making a mouse target script where you click and it instance a explosion and it gets the position of the mouse.I'm not sure why it isnt working..

ex = Instance.new("Explosion")
ex.Position = mouse.Target.Position

0
Let me know if the answer helped you? Chronomad 180 — 8y

1 answer

Log in to vote
0
Answered by
Chronomad 180
8 years ago

There is nothing telling the game to fire this script when the mouse is clicked and the explosions parent is nil. Try this.

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
end)
0
It spawned the explosion but it didnt spawn where the position of the mouse was. UltraUnitMode 419 — 8y
Ad

Answer this question