I'm trying to make this sprint script use Left Control instead of sprint. But it doesn't work Is this right?
local p = game.Players.LocalPlayer
local c = p.Character
local m = p:GetMouse()
local sprint = false
local t,f = true,false
local w,a,s,d = f,f,f,f
local wt = 0
m.KeyDown:connect(function(key)
if key == '50' then
sprint = t
end
if key == 'w' then
w = t
end
if key == 'a' then
a = t
end
if key == 's' then
s = t
end
if key == 'd' then
d = t
end
end)
m.KeyUp:connect(function(key)
if key == '50' then
sprint = f
end
if key == 'w' then
w = f
end
if key == 'a' then
a = f
end
if key == 's' then
s = f
end
if key == 'd' then
d = f
end
end)
while wait() do
wt = wt - .01
if wt <= 0 then
if script.Parent.Frame.Bar.Size.X.Scale < .9 then
script.Parent.Frame.Bar.Size = script.Parent.Frame.Bar.Size + UDim2.new(.009,0,0,0)
end
end
if w or a or s or d then
if script.Parent.Frame.Bar.Size.X.Scale > 0 and sprint then
script.Parent.Frame.Bar.Size = script.Parent.Frame.Bar.Size - UDim2.new(.009,0,0,0)
c.Humanoid.WalkSpeed = 26
end
end
if sprint then
wt = 1.3
end
if not w and not a and not s and not d then c.Humanoid.WalkSpeed = 16 end
if not sprint then c.Humanoid.WalkSpeed = 16 end
if script.Parent.Frame.Bar.Size.X.Scale <= 0 then c.Humanoid.WalkSpeed = 16 end
end

3 comments
KeyDown is deprecated do NOT use it. And wait() should NOT be your condition.
Use InputBegan instead of KeyDown
Also, what key button do you want to use for sprint?