I was making a magic move where the player would send projectiles outwards to the mouse position. Everything went well until I got to the debounce. It worked at first as it should, but then later when I added HumanoidStateType.Jumping (to stop the player from using the move in the air or while jumping) it completely broke the script. The move is now spammable and there are absolutely no errors in the output. Any kind of help would be highly appreciated!
uis.InputBegan:Connect(function(input,processed)
if input.KeyCode == Enum.KeyCode.E and not processed then
local State = hum:GetState()
if deb2 == 1 then
local State = hum:GetState()
if State == Enum.HumanoidStateType.Jumping or State == Enum.HumanoidStateType.Freefall then return end
end
deb2 = 2
print(“Air!”)
Root.CFrame = CFrame.new(Root.Position, Root.Position + Mouse.Hit.LookVector)
event2:FireServer(plr)
anim3:Play()
wait(0.2)
CamShake:Shake(CameraShaker.Presets.Bump)
wait(cd2)
deb2 = 1
end
end)
uis.InputBegan:Connect(function(input,processed)
if input.KeyCode == Enum.KeyCode.E and not processed then
local State = hum:GetState()
if deb2 == 1 then
local State = hum:GetState()
if State == Enum.HumanoidStateType.Jumping or State == Enum.HumanoidStateType.Freefall then return end
end
deb2 = 2
print(“Air!”)
Root.CFrame = CFrame.new(Root.Position, Root.Position + Mouse.Hit.LookVector)
event2:FireServer(plr)
anim3:Play()
wait(0.2)
CamShake:Shake(CameraShaker.Presets.Bump)
wait(cd2)
deb2 = 1
end
end)