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

Why wont my bomb script work I tried putting dofferent wait times a booleans why wont it work?

Asked by 7 years ago

I am trying to make an exploding bomb and it wont work the bomb wont explode it just drops

script

local Handle = script.Parent.Handle

local Explosion = script.Parent.Explosion

local Character = script.Parent.Parent.Parent.Character

local Active = 1

function onClick()
    if Active == 1 then
        local Bomb = Handle:Clone()
        local Script = Explosion:Clone()
        Bomb.Name = "Bomb"
        Bomb.CanCollide = true
        script.Parent = Bomb
        script.Disabled = false
        Bomb.Parent = game.Workspace 
        Bomb.Position = Character.Torso.Position + Vector3.new(0,0,2)
        wait(5)
        Active = 1

    end
end
script.Parent.Activated:connect(onClick) -- this whole script makes a bomb drop
wait(5)

local Explosion = Instance.new("Explosion")

local Blast = Instance.new("Sound")

Blast.SoundId = "rbxasset://sounds\\Rocketshot.wav"

Blast.Parent = Bomb

Blast.Volume = 1

Blast:Play()

Explosion.Parent = Bomb

Explosion.Position = Bomb.Position

Explosion.BlastRadius = 10

Explosion.BlastPressure = 10000000

wait()

Bomb:Remove() -- all the explosion settings
0
First, :Remove() is deprecated. Use :Destroy() instead. Second, you probably meant to use Script (capital S) instead of script on lines 15 and 16. That's a bad variable name anyways, so you should probably use something like explosionScript. GoldenPhysics 474 — 7y

1 answer

Log in to vote
0
Answered by
cc567 50
7 years ago

For your Character variable, use Character = game.Players.LocalPlayer instead.

Ad

Answer this question