How would I go about to making my tool explode when someone clicks (or taps) the screen?
You can use the tool.Activated
event to determine when someone clicks or taps their screen while a tool is equipped, then using Instance.new
you can insert an explosion into the tool. If you want the tool to disappear during or after the explosion, you can do tool:Destroy()
.
if you want the explosion to be only visible for the client, then insert a local script into the tool, and make tool.Activated function and use plr:GetMouse().Hit.p to get the position where the mouse hit and create an explosion in that position. if you want it to be visible for the entire server then you would have to create a remote i think that would create an explosion and fire it from the tool
tool.Activated:Connect(function()
local Explosion = Instance.new("Explosion")
Explosion.Parent = tool.Handle
Explosion.Position = tool.Handle.Position
wait(.1)
tool:Destroy()
end)
I haven’t tested this, but it should work.
Explosion’s position would have to be set to the tool’s position
Explosion.Position = tool.Handle.Position
Woops, I’ll edit that in. Sorry about that.
It is simple, I’ll do two versions for you.
Simple version:
Create a Tool inside of game.StarterPack
or game.Workspace
.
Then, insert a Script and a Part into the Tool.
Now, name the Part ‘Handle’, change it size to 0.1, 0.1, 0.1, turn off ‘CanCollide’ and make it invisible. [ Transparency = 1. ]
Okay, now we can get started with Scripting. Open the Script write what I do:
local Tool = script.Parent
local Handle = Tool.Handle
Debounce = false
Tool.Activated:Connect(function()
if Debounce == false then
Debounce = true
local Explosion = Instance.new('Explosion', Tool.Parent.HumanoidRootPart)
Explosion.Position = Tool.Parent.HumanoidRootPart.Position
local Humanoid = Tool.Parent.Humanoid
Humanoid.Health = 0
end
end)
Then you’re done with the simple version **
The gif contains blood because I was updating my game ‘BloodLine - Alpha.’ when I found your question.
https://gyazo.com/9ad6f2a99cb65781a1110bd462b45986
Complex version:
Create a Tool inside of game.StarterPack
or game.Workspace
.
Then, insert a Script and a Part into the Tool.
Name the Part ‘Handle’, change it size to 0.1, 0.1, 0.1, turn off ‘CanCollide’ and make it invisible. [ Transparency = 1. ]
Then you add a ‘Configuration’ into the tool and name it ‘Animations’.
Now, you add a ‘Animation’ inside of the Animations folder, name the animation ‘PlayerExplode’ and change the AnimationID to your AnimationID.
After that, you insert some sounds into the Tool Handle.
Now, you open the Script on the Tool, then you follow what I write:
local Tool = script.Parent
local Handle = Tool.Handle
local Animations = Tool.Animations
local PlayerExplodeAnimation = Animations.PlayerExplode
local ExplosionSounds = Handle:GetChildren()
local RandomExplosionSound = ExplosionSounds[math.random(1, #ExplosionSounds)]
Debounce = false
local Track01
Tool.Activated:Connect(function()
if Debounce == false then
Debounce = true
local Humanoid = Tool.Parent.Humanoid
Track01 = Tool.Parent.Humanoid:LoadAnimation(PlayerExplodeAnimation)
Track01.Looped = false
Track01:Play()
Humanoid.WalkSpeed = 0
Track01.Stopped:Wait()
RandomExplosionSound:Play()
local Explosion = Instance.new('Explosion', Tool.Parent.HumanoidRootPart)
Explosion.Position = Tool.Parent.HumanoidRootPart.Position
Humanoid.Health = 0
end
end)
The gif contains blood because I was updating my game ‘BloodLine - Alpha.’ when I found your question.
https://gyazo.com/dcf8e001453164d98eb4d2d605ea5c9c
- Very Good.
- Good.
- I don’t know.
- Bad.
- Very Bad.
0 voters
- Tsu Washington / SovietFurryBruh.