Value = false

Player = game.Players.LocalPlayer
Character = Player.Character
Mouse = Player:GetMouse()

Mouse.KeyDown:connect(function(key)
wait()

if key:byte() == 50 then

if Value == true then
wait()
Value = false

elseif Value == false then
wait()
Value = true
end

wait()

if Value then
Character.Humanoid.WalkSpeed = 0
elseif Value == false then
Character.Humanoid.WalkSpeed = 16
end

end
end)

Why wont this work in-game mode? It only does in test mode/studio mode.