how to make this local script work properly ? [closed]
its onkey run gui when you press the key "r" its suppose to make you run and the gui bar goes down when keyup it stops going down and recharges to max
01 | Player = script.Parent.Parent.Parent |
02 | mouse = Player:GetMouse() |
03 | local active = script.Parent.active.Value |
04 | local run = script.Parent.run.Value |
07 | function onKeyDown(key) |
11 | if active = = true then |
14 | script.Parent.Frame.ImageLabel.Size = UDim 2. new(run -i , 0 , 1 , 0 ) |
15 | Player.Character.Humanoid.WalkSpeed = 27 |
20 | mouse.KeyDown:connect (onKeyDown) |
28 | if active = = false then |
31 | script.Parent.Frame.ImageLabel.Size = UDim 2. new(run +i, 0 , 1 , 0 ) |
32 | Player.Character.Humanoid.WalkSpeed = 16 |
37 | mouse.KeyUp:connect (onKeyUp) |