I want it so when the player gets the ball, they can hold m1 to charge up a power meter. If they stop holding m1 midway, the kickmeter will stop at the number its at. And when the m1 is let go off, the ShootBall goes off(that works already)
What is the issue? Include screenshots / videos if possible!
When the player gets the ball, the kickmeter starts automaticly and goes up to max value(12)
What solutions have you tried so far?
I have just tried and error with a lot of different things, that didnt work sadly
local Player = game.Players.LocalPlayer
local Character = script.Parent
local humanoid = Character.Humanoid
local PlrStats = Player:WaitForChild("PlrStats")
local uis = game:GetService("UserInputService")
local Footwork = (PlrStats.Footwork.Value)
local KickMeter = PlrStats.KickMeter
local debounce = false -- debounce for kickmeter
local kicking = uis.InputBegan:Connect(function(input, gpe)
if gpe then return end
while wait(0.1) do
local hasBall = false
if Character.HumanoidRootPart:WaitForChild("GetBallHitbox"):FindFirstChild("Football") then
hasBall = true
end
if input.UserInputType == Enum.UserInputType.MouseButton1 and hasBall == true then
debounce = false
repeat
KickMeter.Value += (Footwork) -- The KickMeter max is 12
wait(0.15)
until
KickMeter.Value >= 12 or debounce == true
if KickMeter.Value > 12 then
KickMeter.Value = 12
end
end
end
end)
uis.InputEnded:Connect(function(input, gpe)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
debounce = true
game.ReplicatedStorage.Remotes.ShootBall:FireServer(KickMeter.Value)
kicking:Disconnect()
KickMeter.Value = 0
end
end)
uis.InputEnded:Connect(function(input, gpe)
if input.UserInputType == Enum.UserInputType.MouseButton1 and hasBall == true and debounce == false then
game.ReplicatedStorage.Remotes.ShootBall:FireServer(KickMeter.Value)
KickMeter.Value = 0
end
end)
uis.InputEnded:Connect(function(input, gpe)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
debounce = true
game.ReplicatedStorage.Remotes.ShootBall:FireServer(KickMeter.Value)
kicking:Disconnect()
KickMeter.Value = 0
end
end)
uis.InputEnded:Connect(function(input, gpe)
if input.UserInputType == Enum.UserInputType.MouseButton1 and debounce == false then
game.ReplicatedStorage.Remotes.ShootBall:FireServer(KickMeter.Value)
KickMeter.Value = 0
end
end)
uis.InputEnded:Connect(function(input, gpe)
if input.UserInputType == Enum.UserInputType.MouseButton1 and debounce == false then
game.ReplicatedStorage.Remotes.ShootBall:FireServer(KickMeter.Value)
KickMeter.Value = 0
end
end)
uis.InputBegan:Connect(function(input, gpe)
if input.UserInputType == Enum.UserInputType.MouseButton1 and debounce == false then
game.ReplicatedStorage.Remotes.ShootBall:FireServer(KickMeter.Value)
KickMeter.Value = 0
end
end)
uis.InputBegan:Connect(function(input, gpe)
if input.UserInputType == Enum.UserInputType.MouseButton1 and debounce == false then
game.ReplicatedStorage.Remotes.ShootBall:FireServer(KickM