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

More Fireball Help: Recharge And Explosion (Collide) Assistance?

Asked by
Jxemes 75
7 years ago

I got some help yesterday on my fireball script, and turns out I made a few errors. I got help and It was fixed. I would like the fireball be similar to Elemental Battlegrounds' Fireball. Now I'm trying to experiement of how to make a wait function "wait(5)" so you won't be able to spam the spell. It won't work, and I don't know why, and I made an explode model instead of using ROBLOX's default explosion. So I need help. Here's what I have.

01local me = game.Players.LocalPlayer
02local tool = script.Parent
03local ws = game:GetService("Workspace")
04 
05tool.Equipped:connect(function(mouse)
06    mouse.Button1Down:connect(function()
07        handle = me.Character:FindFirstChild("Torso")
08        if handle== nil then
09            handle=me.Character.UpperTorso
10            end
11        local p = Instance.new("Part")
12        p.CFrame = CFrame.new(handle.Position)
13        p.TopSurface = "Smooth"
14        p.BottomSurface = "Smooth"
15        p.Shape = Enum.PartType.Ball
View all 30 lines...

Got any tips, ideas or hints? Thanks for the help.

2 answers

Log in to vote
1
Answered by 7 years ago
Edited 7 years ago

Here's the issue for your cooldown, you must use a debounce function. It would help out greatly, because if you use the wait, you can still spam it, but the spam will be delayed to 5 seconds after. Here is your script with debounce implemented:

01local me = game.Players.LocalPlayer
02local tool = script.Parent
03local ws = game:GetService("Workspace")
04local debounce = false
05 
06tool.Equipped:connect(function(mouse)
07    mouse.Button1Down:connect(function()
08    if not debounce then
09    debounce = true
10        handle = me.Character:FindFirstChild("Torso")
11        if handle== nil then
12            handle=me.Character.UpperTorso
13            end
14        local p = Instance.new("Part")
15        p.CFrame = CFrame.new(handle.Position)
View all 35 lines...

Make sure to notify me if this does not work!

0
It works, but made a new problem, I typed it on my answers, so what the error is, is whenever the ball hits the Baseplate or something without a humanoid, it will not recharge. Jxemes 75 — 7y
Ad
Log in to vote
0
Answered by
Jxemes 75
7 years ago

Humanoid is not a valid member of Workspace 17:51:03.295 - Stack Begin 17:51:03.297 - Script 'Players.Player1.Backpack.Fireball.Main', Line 32

Answer this question