- What do you want to achieve?: I wanna be able to make a new power Gui for my football game being able to make the bar move cleanly with no bugs
- What is the issue?: I have tried reright the whole line of code but it hasn’t worked
- What solutions have you tried so far?: The only solution I have it so just code a new football
The script comes from the cabbler football
The Gui:
local tool = handle.Parent
local remoteEvent = handle:WaitForChild('RemoteEvent')
local player = game.Players.LocalPlayer
local UIS = game:GetService('UserInputService')
local TS = game:GetService("TweenService")
local CAS = game:GetService('ContextActionService')
local gui = script:WaitForChild('BallGui'):Clone()
local power = 60
local powerChange = 5
if handle:WaitForChild('Configuration'):WaitForChild('RememberPower').Value then
pcall(function()
power = tonumber(script.BallGui.Frame.Disp.Text)
end)
end
--handoff input
function ho(str,state,obj)
if state == Enum.UserInputState.Begin then
remoteEvent:FireServer({'x down'})
else
remoteEvent:FireServer({'x up'})
end
end
--recolor the power wheel and change number
function reDisplay()
for i,v in pairs(gui.Power.PowerFrame.BarBackup.Text.Speed:GetChildren()) do
if v.Name~="Disp" then
end
end
gui.Power.PowerFrame.BarBackup.Text.Speed.Text=power
end
local mouse = player:GetMouse()
mouse.TargetFilter = game.Workspace
tool.Equipped:connect(function(mouse)
mouse.TargetFilter = game.Workspace
mouse.Icon = "rbxasset://textures//Cursors//Gamepad//Pointer.png"
mouse.Button1Down:connect(function()
--mouse click
local target = mouse.Hit.p
local head = player.Character:FindFirstChild('Head')
if head then
--thrown event
local origin = head.CFrame.p
gui:Destroy()
remoteEvent:FireServer({'Clicked',origin,target,power})
end
end)
gui.Parent = player.PlayerGui
reDisplay()
--mobile button
CAS:BindAction('Handoff', ho, true, Enum.KeyCode.X)
CAS:SetImage('Handoff',"rbxasset://textures//ui//Settings//Help//XButtonDark.png")
end)
tool.Unequipped:connect(function(mouse)
gui.Parent = nil
CAS:UnbindAction('Handoff')
end)
--power change input
UIS.InputBegan:connect(function(input,gpe)
if not gpe then
if input.UserInputType == Enum.UserInputType.Keyboard then
--key down
local key = input.KeyCode
if key == Enum.KeyCode.R then
while UIS:IsKeyDown(key) do
power=math.min(100,power+powerChange)
reDisplay()
wait( powerChange/30 );
end
elseif key == Enum.KeyCode.F then
while UIS:IsKeyDown(key) do
power=math.max(0,power-powerChange)
reDisplay()
wait( powerChange/30 );
end
end
end
end
end)```