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

How do i make a explosion script in the gear after 2.70 seconds of gear equipped?

Asked by 3 years ago
Edited 3 years ago

heres what i want it to be

https://youtu.be/-FPdkbvs4KM

heres the code

local Tool = script.Parent;

enabled = true

function onActivated() if not enabled then return end

enabled = false
Tool.GripForward = Vector3.new(0,-.759,-.651)
Tool.GripPos = Vector3.new(1.5,-.5,.3)
Tool.GripRight = Vector3.new(1,0,0)
Tool.GripUp = Vector3.new(0,.651,-.759)


Tool.Handle.DrinkSound:Play()

wait(3)

local h = Tool.Parent:FindFirstChild("Humanoid")
if (h ~= nil) then
    if (h.MaxHealth > h.Health + 5) then
        h.Health = h.Health + 5
    else    
        h.Health = h.MaxHealth
    end
end

Tool.GripForward = Vector3.new(-.976,0,-0.217)
Tool.GripPos = Vector3.new(0.03,0,-0.3)
Tool.GripRight = Vector3.new(.217,0,-.976)
Tool.GripUp = Vector3.new(0,1,0)

enabled = true

end

function onEquipped() Tool.Handle.OpenSound:play() end

script.Parent.Activated:connect(onActivated) script.Parent.Equipped:connect(onEquipped)

1 answer

Log in to vote
0
Answered by
imKirda 4491 Moderation Voter Community Moderator
3 years ago
Edited 3 years ago

Just create an explosion and position it where you need

wait(2.7)

local Explosion = Instance.new("Explosion")
Explosion.Position = Tool.Handle.Position
Explosion.Parent = Tool

Make sure to parent it ASAP because explosions dissapear after few seconds if not parented because they explode right after being created.

So here is the whole script:

local Tool = script.Parent;

enabled = true

function onActivated() if not enabled then return end
enabled = false
Tool.GripForward = Vector3.new(0,-.759,-.651)
Tool.GripPos = Vector3.new(1.5,-.5,.3)
Tool.GripRight = Vector3.new(1,0,0)
Tool.GripUp = Vector3.new(0,.651,-.759)


Tool.Handle.DrinkSound:Play()

wait(3)
-----------------
local Explosion = Instance.new("Explosion")
Explosion.Position = Tool.Handle.Position
Explosion.Parent = Tool
-----------------

local h = Tool.Parent:FindFirstChild("Humanoid")
if (h ~= nil) then
    if (h.MaxHealth > h.Health + 5) then
        h.Health = h.Health + 5
    else    
        h.Health = h.MaxHealth
    end
end

Tool.GripForward = Vector3.new(-.976,0,-0.217)
Tool.GripPos = Vector3.new(0.03,0,-0.3)
Tool.GripRight = Vector3.new(.217,0,-.976)
Tool.GripUp = Vector3.new(0,1,0)

enabled = true
end

function onEquipped() Tool.Handle.OpenSound:play() end

script.Parent.Activated:connect(onActivated) script.Parent.Equipped:connect(onEquipped)
0
thanks dude it helped???? WesleyAng_3 153 — 3y
0
no problem???? imKirda 4491 — 3y
Ad

Answer this question