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

How do I make my fireball explode?

Asked by 4 years ago
Edited 4 years ago

Explode as in different spheres expanding outwards on contact with a surface. Not exploding like a grenade.

Player = game.Players.LocalPlayer
local Mouse = game.Players.LocalPlayer:GetMouse()
Ammo = 1

Mouse.KeyDown:Connect(function(key)
    key = key:lower()
    if key == "f" and Ammo>0 then
        local x = Instance.new("Part", workspace)
        x.Shape = "Ball"
        x.BrickColor = BrickColor.new("Deep orange")
        x.Transparency = 0.3
        x.TopSurface = "Smooth"
        x.BottomSurface = "Smooth"
        x.CanCollide = false
        x.Parent = workspace
        x.CFrame = Player.Character.HumanoidRootPart.CFrame*CFrame.new(0,0,-6)
        local v = Instance.new("BodyVelocity",x)
        v.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
        v.Velocity = (x.Position - Mouse.hit.p).unit*-100

        Ammo = Ammo-1
        wait(2)
        Ammo = 1
        x:remove()

    end
end)
0
Use a touched function on the Part called X Prestory 1395 — 4y
0
Listen to Touched of x. When fired, increase the size of x and disconnect the event using Disconnect. Fyi, (x.Position - mouse.Hit.Position).Unit is the same thing mouse.Hit.LookVector pidgey 548 — 4y
0
Actually i suggest creating a new part and setting its position to x for the explosion instead of increasing the size of the original projectile Prestory 1395 — 4y
0
^ pidgey 548 — 4y
0
I got it fixed. using a script instead of a Local Script. AverageMonkey112 0 — 4y

Answer this question