I'm trying to make my mana intValue rise the moment I hold g but it won't rise, I don't understand what I did wrong.. Maybe the way I used the while true do loop?
I don't know please help me with it.
The Code:
local UIS = game:GetService("UserInputService")
local RS = game:GetService("ReplicatedStorage")
local RE = RS.ManaEvent
local plr = game.Players.LocalPlayer
local mana = plr:WaitForChild("Stats").Mana
local charging = false
local function started(input,gameProcessed)
UIS.InputBegan:Connect(function(input, gameProcessedEvent)
if input.KeyCode == Enum.KeyCode.G and charging == false then
charging = true
end
end)
local function ended(input,gameProcessed)
UIS.InputEnded:Connect(function(input, gameProcessedEvent)
if input.KeyCode == Enum.KeyCode.G and charging == true then
charging = false
end
end)
UIS.InputBegan:Connect(started)
UIS.InputEnded:Connect(ended)
if charging == true then
while true do
wait(.03)
if mana.Value == 100 then
end
end
else
mana.Value = mana.Value + 1
end
end
end
Thanks a lot.

1 comment
oops didn't fix the gameProcessed thing