I watched a youtube tutorial about making a magic tool and made one myself! My problem is that the tool is spammable. I added a debounce script and it worked! But if you re-equip the tool, the debounce will not work. My tool uses a Tool.Equipped function in order to activate the script that actually shoots the projectile.
here are both the scripts
Tool.Equipped
local Tool = script.Parent
Tool.Equipped:Connect(function()
script.Equip.Disabled = false
end)
Tool.Unequipped:Connect(function()
wait(5)
script.Equip.Disabled = true
end)
the script that leads into a remote function (the script is disabled until the player equips the tool)
local UIS = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local Debounce = true
local mouseDown = false
-- ANimation---
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local animInstance = Instance.new("Animation")
animInstance.AnimationId = "rbxassetid://6715952610" -- Animation
local SlashAnim = humanoid:LoadAnimation(animInstance) -- SlashAnim You Can Change Name
--Sound--
local Sound = script:WaitForChild("SlashSound") -- Name of Sound
local Player = Game.Players.LocalPlayer
local Mouse = Player:GetMouse()
Mouse.Button1Down:Connect(function()
if Debounce == true then
Debounce = false
--Animation--
SlashAnim:Play() -- Animation Work
--Sound--
Sound:Play() -- Sound Work
----------
script.RemoteEvent:FireServer(plr)
wait(10) -- Cooldown
Debounce = true
script.Parent.Name = "Skull Blast"--change name to whatever tool you're using
end
end)