Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I turn this into a script that will blow up wherever I click?

local tool = script.Parent
local handle = tool.Handle
local Player = game.Players.LocalPlayer
local mouse = Player:GetMouse()
local at = 2

tool.Activated:Connect(function()
	--WEAPON EFFECT
	local expo = Instance.new("Explosion", workspace)
	expo.Position = mouse.Hit
	wait(at)
	expo:Destroy()
end)

I tried to do something but it is now broken.

2 answers

✓ Accepted answer

the handle of the tool is not loaded yet so you get an error saying Handle is not a vaild member of Tool and you should say the mouse position like this:

local tool = script.Parent
local handle = tool:WaitForChild("Handle")
local Player = game.Players.LocalPlayer
local mouse = Player:GetMouse()
local at = 2

tool.Activated:Connect(function()
	--WEAPON EFFECT
	local expo = Instance.new("Explosion", workspace)
	expo.Position = mouse.Hit.Position
	wait(at)
	expo:Destroy()
end)

7 comments

0

didn't work, weird

0

i've tested it and it worked

0

and if the script is a normal script then change it to a local script and write this

0

although would that be FE script?

0

Just checked it's not, well still thanks

0

thats weird tbh

0

does it give you an error message? if so tell me what it says

the handle of the tool is not loaded yet so you get an error saying Handle is not a vaild member of Tool and you should say the mouse position like this:

local tool = script.Parent
local handle = tool:WaitForChild("Handle")
local Player = game.Players.LocalPlayer
local mouse = Player:GetMouse()
local at = 2

tool.Activated:Connect(function()
	--WEAPON EFFECT
	local expo = Instance.new("Explosion", workspace)
	expo.Position = mouse.Hit.Position
	wait(at)
	expo:Destroy()
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.