I am trying to add an ability to my tool you can activate by pressing “Q” on your keyboard, but it is not working.
The script is a ServerScript.
The script is in the tool itself and not any parts inside the tool.
There is nothing in the output.
Script:
local CanUse = true
local Tool = script.Parent
Remote = (Tool:FindFirstChild("Remote") or Instance.new("RemoteEvent"));Remote.Name = "Remote";Remote.Parent = Tool
function Test()
game.Workspace.Sound:Play()
end
Character = nil
Humanoid = nil
Player = nil
function Equip()
Character = Tool.Parent
Humanoid = Character:FindFirstChild("Humanoid")
Player = game.Players:GetPlayerFromCharacter(Character)
end
function Special(Client, Key)
if not Client or Client ~= Player or not Key or not Tool.Enabled or Humanoid.Health <= 0 or CanUse then return end
if Key == Enum.KeyCode.Q then
if CanUse == true then
CanUse = false
Test()
wait(9)
CanUse = true
end
end
end
Tool.Equipped:Connect(Equip)
Remote.OnServerEvent:Connect(Special)
How do I fix this?