#Goal:# My goal is to create a debounced move, this seems extremely simple but for some reason, it's not working. Currently, it works the first time I join but doesn't work anymore. It does give me an error though
#Script:# Module (ReplicatedStorage):
local MovesInfo = {
Fireball = {
Damage = 4;
Cooldown = 5;
};
};
return MovesInfo
LocalScript (StarterCharacterScripts):
local QDebounce = true
local Animations = {
GreatFireBall = ReplicatedStorage.Animations['Great Fire Ball Animation [0.7]'];
}
local RE = {
GreatFireBall = ReplicatedStorage.RemoteEvents.Moves['Great Fireball'];
}
local function FunctionLoadAndPlay(Humanoid, Move)
if Move == 'Fireball' then
local Animation = Humanoid:LoadAnimation(Animations.GreatFireBall)
Animation:Play()
end
end
UIS.InputBegan:Connect(function(Input, IsTyping)
if IsTyping then return end
local KeyCode = Input.KeyCode
print(QDebounce)
if QDebounce and KeyCode == Enum.KeyCode.Q and Char and UsingMove then
local Move = Q.Value
QDebounce = false
print(QDebounce)
UsingMove.Value = true
RE.GreatFireBall:FireServer(Mouse.Hit, Move)
FunctionLoadAndPlay(Humanoid, Move)
wait(0.7)
print(QDebounce)
UsingMove = false
wait(Moves.Fireball.Cooldown)
QDebounce = true
print(QDebounce)
end
end)
Note that QDebounce is local QDebounce = true as a variable
#Prints:#
true (x17) false false true true (x50)
Error:
17:00:45.501 - Workspace.BlackOrange3343_YT.Moves:48: attempt to index upvalue 'UsingMove' (a boolean value) 17:00:45.504 - Stack Begin 17:00:45.506 - Script 'Workspace.BlackOrange3343_YT.Moves', Line 48 17:00:45.508 - Stack End
which is if QDebounce and KeyCode == Enum.KeyCode.Q and Char and UsingMove then
I don't see why it works once but doesn't a second time.
How can I fix this? I Appreciate any helpful feedback thank you for reading.

1 comment
http://wiki.roblox.com/index.php?title=API:Class/IntValue/Value