This code is inside of a local script which is inside of the stamina bar that should get smaller after "q" is pressed. Neither the character's walk speed nor the re-sizing of the stamina bar is working. Can someone help me figure this out? I'm not very good at scripting.
function onKeyDown(key)
if key ~= nil then
key = key:lower()
if key == "q" then
script.Parent.Parent.Parent.Parent.Parent.WalkSpeed = 25
for i = 1, 0, -0.001 do
script.Parent.Size = 0.999
wait(0.000001)
end
end
end
end
function onSelected(mouse)
mouse.KeyDown:connect(onKeyDown)
end
