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 4 years ago
01local tool = script.Parent
02local handle = tool.Handle
03local Player = game.Players.LocalPlayer
04local mouse = Player:GetMouse()
05local at = 2
06 
07tool.Activated:Connect(function()
08    --WEAPON EFFECT
09    local expo = Instance.new("Explosion", workspace)
10    expo.Position = mouse.Hit
11    wait(at)
12    expo:Destroy()
13end)

I tried to do something but it is now broken.

2 answers

Log in to vote
0
Answered by
mroaan 95
4 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:

01local tool = script.Parent
02local handle = tool:WaitForChild("Handle")
03local Player = game.Players.LocalPlayer
04local mouse = Player:GetMouse()
05local at = 2
06 
07tool.Activated:Connect(function()
08    --WEAPON EFFECT
09    local expo = Instance.new("Explosion", workspace)
10    expo.Position = mouse.Hit.Position
11    wait(at)
12    expo:Destroy()
13end)
0
didn't work, weird RedSoloYT 10 — 4y
0
i've tested it and it worked mroaan 95 — 4y
0
and if the script is a normal script then change it to a local script and write this mroaan 95 — 4y
0
although would that be FE script? RedSoloYT 10 — 4y
View all comments (3 more)
0
Just checked it's not, well still thanks RedSoloYT 10 — 4y
0
thats weird tbh mroaan 95 — 4y
0
does it give you an error message? if so tell me what it says mroaan 95 — 4y
Ad
Log in to vote
0
Answered by
mroaan 95
4 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:

01local tool = script.Parent
02local handle = tool:WaitForChild("Handle")
03local Player = game.Players.LocalPlayer
04local mouse = Player:GetMouse()
05local at = 2
06 
07tool.Activated:Connect(function()
08    --WEAPON EFFECT
09    local expo = Instance.new("Explosion", workspace)
10    expo.Position = mouse.Hit.Position
11    wait(at)
12    expo:Destroy()
13end)

Answer this question