Hey there! I’m making a game but something odd is happening when i am trying to do something. So basically, i would like the Cooldown value to be modified as there’s multiple abilities and the system works well, but the local script is not working.
local UIS = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local rs = game.ReplicatedStorage
local remote = rs.Ability.AbilityRemote
local Debounce = false
local CD = script:FindFirstChild("CD")
local Ability = plr.PlayerGui.Main.Ability.Ability
UIS.InputBegan:Connect(function(key)
if Debounce == false then
if key.KeyCode == Enum.KeyCode.E then
remote:FireServer(plr, Ability)
Debounce = true
wait (0.1)
wait (CD.Value) -- where the bug happens.
Debounce = false
end
end
end)
Image:
Could somebody help?