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

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

Asked by 3 years ago
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

Log in to vote
0
Answered by
mroaan 95
3 years ago

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)
0
didn't work, weird RedSoloYT 10 — 3y
0
i've tested it and it worked mroaan 95 — 3y
0
and if the script is a normal script then change it to a local script and write this mroaan 95 — 3y
0
although would that be FE script? RedSoloYT 10 — 3y
View all comments (3 more)
0
Just checked it's not, well still thanks RedSoloYT 10 — 3y
0
thats weird tbh mroaan 95 — 3y
0
does it give you an error message? if so tell me what it says mroaan 95 — 3y
Ad
Log in to vote
0
Answered by
mroaan 95
3 years ago

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)

Answer this question