Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

how to make this local script work properly ? [closed]

Asked by 10 years ago

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

Player = script.Parent.Parent.Parent
mouse = Player:GetMouse()
local active = script.Parent.active.Value
local run = script.Parent.run.Value
run = 1
   active = false
function onKeyDown(key)
    key = key:lower()
    if key == "r" then 
        active = true
        if active == true then
for i = 0,1,0.005 do
    wait()
    script.Parent.Frame.ImageLabel.Size = UDim2.new(run -i , 0, 1, 0)
    Player.Character.Humanoid.WalkSpeed = 27
end
end
    end
    end
mouse.KeyDown:connect (onKeyDown)


function onKeyUp(key)
    key = key:lower()
    if key == "r" then 
        print'up'
        active = false
        if active == false then
for i = 0,1,0.005 do
    wait()
    script.Parent.Frame.ImageLabel.Size = UDim2.new(run +i, 0, 1, 0)
    Player.Character.Humanoid.WalkSpeed = 16
end
end
    end
    end
mouse.KeyUp:connect (onKeyUp)
0
I suggest you look into proper code formatting and fix that up, it's difficult to read. Are you getting any errors, is the code running *at all*? Where is this LocalScript located? adark 5487 — 10y
0
its in a gui and it does work but it doesnt stop and keyup it goes past the max Layfonex 0 — 10y
0
You're going to have to tell us what the issue you are having is before we can help. FearMeIAmLag 1161 — 10y
0
I understand the issue, but I don't understand the intent of this code. @OP; what do each of the Values mean? adark 5487 — 10y

Closed as Not Constructive by FearMeIAmLag, EzraNehemiah_TF2, and BlueTaslem

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?